
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 22, 2020 10:10 AM
I would like to create a script that creates a number of records based on a quantity field. Essentially, if there is a record that has a quantity (x) of more than 1, I want to copy and create that record x amount of times within the table, then lower the quantity for the record and each subsequent record to 1.
I have some of the script set up. Are there any ideas on how I could specify the # of records to create, based on the quantity field, using createRecordsAsync in the Scripting Block?
As usual, thanks for the help!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 10, 2022 04:41 PM
Hi,
you missed for loop counter increment.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 12, 2022 05:17 AM
@Lisa_Bauer - a couple of things to note:
- As per @Alexey_Gusev, you are missing the incrementer on the loop, so this:
for (let i = 0; i < quantity-1)
should be something like this:
for (let i = 0; i < quantity-1; i++)
I can see that on the last line of the script you also have the 3 backticks, which may not be in your actual script, but are shown here, so worth checking that they are not there.
One other thing to note - your create records action - last line - works on the recordsArray, which is all good, but the action is limited to creaitng 50 records, so if you array could contain more than 50 records, you need to do something like:
while (recordsArray.length > 0) {
await table.createRecordsAsync(recordsArray.slice(0, 50));
recordsArray = recordsArray.slice(50);
}

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 12, 2022 06:24 AM
Thank you both for your helpful reply and assistance!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 09, 2022 11:01 AM
This is excellent and very close to what I’m trying to do.
Is there a way to produce all the records at once?
let record = await input.recordAsync(‘Please select a order’, orders);
and just to get greedy: by button?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 12, 2022 09:12 AM
Hi @Houston_Llew - there’s a variation on this theme higher up in the thread that I think does what you are asking for:
Is this what you mean?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 06, 2023 03:18 AM
Hello all, I am looking at doing almost the same as above, however instead of "quantity", I would like it to be a linked cell with an array of data (in my case names). What would need to be changed to achieve this?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 10, 2023 10:11 AM
Could you help me modify this script?

- « Previous
- Next »