cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted

How to set a default value in a dropdown field based on another list last record

Hi , @v-xida-msft , its me again. I have 2 lists, 

 

  • SalesTable
  • Salesdetails_1

In the sales Table I have a Column for Invoice number with Text format.

In the Salesdetails_1 I have a lookup for that Invoice number column. 

My requirement is to show the last Invoice number in the edit screen related to Salesdetails_1 as the default value. How can I do that please?

 

Capture.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to set a default value in a dropdown field based on another list last record

@v-yutliu-msft Hi thank you for your code. I tried it but it did not work under Default. Then I tried DefaultSelectedItems and it worked. 

 

Thank you again. 

 

Also I want to know how to get a Sum from Salesdetails_1 by looking for the Invoice number. 

 

e.g My last Invoice number is 07. and it has 2 lines respectively 10,000 and 5,000. SO I want to get the total for the Invoice 07 as 15,000 in a lable. 

Should I open a new tread for this or will you be able to help in this thread ?

 

Osmand. 

 

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: How to set a default value in a dropdown field based on another list last record

Hi @OsmandFernando ,

Do you want to display the last Invoice number of SalesTable in the drop down of Salesdetails_1's edit form?

If so, firstly you need to unlock Invoice number datacard firstly.

Then, set the drop down's Items:

Choices(Salesdetails_1.lookupfield)

set the drop down's Default:

LookUp(Choices(Salesdetails_1.lookupfield),Value=Last(SalesTable).Invoice number,Value)

Please note that the drop down Items is a table with two columns named Value and Id.

In the second formula, I use the last record's Invoice number to filter the item in the drop down Items, and then return the Value.

 

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Re: How to set a default value in a dropdown field based on another list last record

@v-yutliu-msft Hi thank you for your code. I tried it but it did not work under Default. Then I tried DefaultSelectedItems and it worked. 

 

Thank you again. 

 

Also I want to know how to get a Sum from Salesdetails_1 by looking for the Invoice number. 

 

e.g My last Invoice number is 07. and it has 2 lines respectively 10,000 and 5,000. SO I want to get the total for the Invoice 07 as 15,000 in a lable. 

Should I open a new tread for this or will you be able to help in this thread ?

 

Osmand. 

 

View solution in original post

Re: How to set a default value in a dropdown field based on another list last record

Hi @v-yutliu-msft any update for my last comment?

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (3,793)