cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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 @Anonymous :

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 @Anonymous ,

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 @Anonymous :

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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,688)