cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PBIUWO
Resolver I
Resolver I

SaveData and Populating Dropdown and Combo box

Hi Everyone,

 

I have an app that scans barcodes, and collects them.

There are also DropDown boxes / Combo Box , and the selected values are collected while being scanned. (Each selected value is applied to each scan) 

This app uses SaveData after each scan. So once you leave the app, it's able to restore the data as LoadData is applied OnStart. 

 

When I exit the app, and reopen it. The selected values from DropDown boxes / Combo Box are empty again. 

 

How can I populate the Dropdownboxes with SaveData information in the collection? 

 

Thank you, 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @PBIUWO :

I think I may understand what you mean, if my understanding is incorrect, please help me to point it out.

  • The BarcodeScanner OnScan event performs the following operations:
    1)Collect barcode into collection
    2)Save the collection locally
  • Load the collection when the app opens
  • When the program is opened, the dropdown control selects the most recently scanned barcode by default

I think this can be achieved by setting the default property of the dropdown control.

I've made a test for your reference:

1\OnStart:

 

LoadData( MyItems, "LocalSavedItems" ) /*MyItems is my custom collection*/

 

2\Add a BarcodeScanner control(BarcodeScanner1):

OnScan:

 

Collect(MyItems,{Barcode:BarcodeScanner1.Value,date:Now()}); /*Record scan time is used to filter the last scan record*/
SaveData( MyItems, "LocalSavedItems" )

 

3\Add a dropdown control:

Items:

 

MyItems

 

Default:

 

First(Sort(MyItems,date,Descending)).Barcode

 

I tested it on my phone. Every time I reopen the app, the dropdown control always selects the most recently scanned barcode by default

Best Regards,

Bof

 

View solution in original post

2 REPLIES 2
WarrenBelz
Super User III
Super User III

Hi @PBIUWO ,

What are the Items of the drop-downs? They need to be based on the collection (or hard-coded) if you are wanting them to work offline.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

v-bofeng-msft
Community Support
Community Support

Hi @PBIUWO :

I think I may understand what you mean, if my understanding is incorrect, please help me to point it out.

  • The BarcodeScanner OnScan event performs the following operations:
    1)Collect barcode into collection
    2)Save the collection locally
  • Load the collection when the app opens
  • When the program is opened, the dropdown control selects the most recently scanned barcode by default

I think this can be achieved by setting the default property of the dropdown control.

I've made a test for your reference:

1\OnStart:

 

LoadData( MyItems, "LocalSavedItems" ) /*MyItems is my custom collection*/

 

2\Add a BarcodeScanner control(BarcodeScanner1):

OnScan:

 

Collect(MyItems,{Barcode:BarcodeScanner1.Value,date:Now()}); /*Record scan time is used to filter the last scan record*/
SaveData( MyItems, "LocalSavedItems" )

 

3\Add a dropdown control:

Items:

 

MyItems

 

Default:

 

First(Sort(MyItems,date,Descending)).Barcode

 

I tested it on my phone. Every time I reopen the app, the dropdown control always selects the most recently scanned barcode by default

Best Regards,

Bof

 

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,179)