cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OsmandFernando
Post Prodigy
Post Prodigy

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

@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
v-yutliu-msft
Community Support
Community Support

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.

@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

OsmandFernando
Post Prodigy
Post Prodigy

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

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,231)