cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
cn
Level: Powered On

Update Lookup additonal Fields and use them in a calculation

I am working on a sharepoint solution which is based on two lists:

 

List "Trainings" - a list of possible trainings with the Columngs (Title, Number of Days, Possible Trainee)

List "Training-Planning" - a list where the training gets a start- and enddate and a list auf participants

 

I want to create a more user-friendly form for the List "Training-Planning"with Powerapps.

In this form i want to:

 

- Select the Training Title, which is a LookUp-Field from "Training-Planning" to "Trainings".

- Select the startdate with date selection

- Predefine the end-date with the information "Number of days" from the "Trainings" List.

 

I mange to add "x Days" to the end-date, but i do not manage to use the real number of days associated to each training. I think i get confused with to many different approaches. 

 

Does anybody have a good suggestion how to achieve this? Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Update Lookup additonal Fields and use them in a calculation

Hi @cn ,

Do you want to get the real number of days associated to the selected training within the Training Title in your Edit form, and add it to the selected Start Date value?

Does the 'Training Title' column in your "Training-Planning" list reference the Title column values in your "Trainings" list?

 

Based on the issue that you mentioned, I think the combination of LookUp function and DateAdd function could achieve your needs.

 

I have made a test on my side, please take a try with the following workaround:

Set the DefaultDate property of the EndDatePicker control within your Edit form to following formula (I assume that your end date could also be populated with DatePicker control):

DateAdd(
                StartDatePicker.SelectedDate,
                LookUp(Trainings, Title = TrainingTitleComboBox.Selected.Value, 'Number of Days'), /* <-- I assume that the 'Number of Days' column is a Number type column in your Tranings list */
Days )

Note: The Trainings represents your Trainings list. TrainingTitleComboBox represents the ComboBox control within the Training Title Data card in your Edit form.

 

If the 'Number of Days' column is a Text type column, please modify above formula as below:

DateAdd(
                StartDatePicker.SelectedDate,
                Value(LookUp(Trainings, Title = TrainingTitleComboBox.Selected.Value).'Number of Days'), /* <-- I assume that the 'Number of Days' column is a Number type column in your Tranings list */
Days )

 

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Super User
Super User

Re: Update Lookup additonal Fields and use them in a calculation

When you do your lookup to the Trainings record, you can access the other columns on that record by using their name.  Here's an example from an app I am working on:   

LookUp(Assets, Asset = tiAssetID.Text).Title  

Here I am looking up a document in list Assets based on a text input field into which the user enters an asset ID.  By doing this lookup I am validating this is a good and then I am returning the value in the Title column which happens to be the name of my asset.

 

Here's another example where I am looking up a code value for a CollateralType used in a gallery and returning the CollateralTypeName which is what I actually want to display on the screen.

LookUp(CollateralTypes,CollateralType = ThisItem.tmpCTID).CollateralTypeName

You should be able to do the same to return the number of days for the training type selected and use it in your calculation.

 

 

Community Support Team
Community Support Team

Re: Update Lookup additonal Fields and use them in a calculation

Hi @cn ,

Do you want to get the real number of days associated to the selected training within the Training Title in your Edit form, and add it to the selected Start Date value?

Does the 'Training Title' column in your "Training-Planning" list reference the Title column values in your "Trainings" list?

 

Based on the issue that you mentioned, I think the combination of LookUp function and DateAdd function could achieve your needs.

 

I have made a test on my side, please take a try with the following workaround:

Set the DefaultDate property of the EndDatePicker control within your Edit form to following formula (I assume that your end date could also be populated with DatePicker control):

DateAdd(
                StartDatePicker.SelectedDate,
                LookUp(Trainings, Title = TrainingTitleComboBox.Selected.Value, 'Number of Days'), /* <-- I assume that the 'Number of Days' column is a Number type column in your Tranings list */
Days )

Note: The Trainings represents your Trainings list. TrainingTitleComboBox represents the ComboBox control within the Training Title Data card in your Edit form.

 

If the 'Number of Days' column is a Text type column, please modify above formula as below:

DateAdd(
                StartDatePicker.SelectedDate,
                Value(LookUp(Trainings, Title = TrainingTitleComboBox.Selected.Value).'Number of Days'), /* <-- I assume that the 'Number of Days' column is a Number type column in your Tranings list */
Days )

 

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
cn
Level: Powered On

Re: Update Lookup additonal Fields and use them in a calculation

Perfect! That is exactly what i needed. Thanks a lot Smiley Happy.


Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 33 members 4,409 guests
Please welcome our newest community members: