Hi @Pseifert :
Could you tell me if you want to implement the following functions:
- Generate the scan result as a record and store it in a collection.
- This collection stores up to 15 records.
- When there are 15 records in the collection, the system prompts the user to submit.
- After the user clicks the submit button, these 15 records will be added to the data source at once, and then the collection will be emptied.
- Loop the above operations.
I assume my assumption holds.
I've made a test for your reference:
My Date source:'[dbo].[Table_2]'
| Field Name | Date Type |
| barcode | varchar(50) |
| upticks | int |
| id | int/Primary key |
1\Add a BarcodeScanner control(BarcodeScanner1)
OnScan:
If(
CountRows(mycollection) > 15,
Notify("Cache is full, please submit data"), /*When the collection storage record reaches 15, it prompts the user to submit data in time*/
Collect(
mycollection,
{
barcode: BarcodeScanner1.Value,
upticks: 1,
id: CountRows('[dbo].[Table_2]') + CountRows(mycollection) + 1 /*id is the Primary Key of my data source*/
}
)
)
2\Add a button
OnSelect:
Collect('[dbo].[Table_2]',mycollection);Clear(mycollection)
Use collect to submit multiple records at once to avoid calling the API multiple times. Clear the collection after submission.
Best Regards,
Bof