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
Super User

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

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,929)