Help

Re: Using field value as input variable to create multiple entires in linked child table

608 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Felipe_Torres_T
4 - Data Explorer
4 - Data Explorer

Hello community!

I’m very new to Airtable and colleagues of mine - who are using Airtable very intensively - are using one of the communities’s script automations to create a child table linked to a parent table with a number of entries that is controlled by a “on-run” string-input from the user that originally has triggered the automation by clicking on a button at a given row in the parent table.

The script is “Multiple records w/prompt”:

Screenshot 2022-03-15 at 21.24.06

What I’m trying to achieve is that, instead of waiting for the manual input from the user during execution to determine how many entries the script should create at the child table, as per line

const newRecordCount = hardCoded.newRecordCount
? parseInt(hardCoded.newRecordCount, 10)
: parseInt(await input.textAsync(‘Number of records to create’), 10);

I would like to use the value of a field (column) that actually contains the number of entires to be created in the child table.

More precisely, in the first row of this example:

Screenshot 2022-03-15 at 21.28.27

after pressing the button “Create Tracks” the script should create in the child table 10 tracks that are linked to the parent table, without the need of the user (who pressed the button) to manually input 10 into the field that pops up on pressing the button:

Screenshot 2022-03-15 at 21.31.13

I have tried a couple of variations of “.getCellValue()” but without success.

Any help is very appreciated :grinning_face_with_big_eyes:

Thank you very much!
Felipe

2 Replies 2
Sean_Wilson
6 - Interface Innovator
6 - Interface Innovator

Could you paste the code in here amongst the

code tags

so we can have a look at it more?
Looks really simple to implement though. The button you click create Tracks passes the record to the script and then you just create let the const newRecordCount be updated after the record is found.
You should also have a const called ‘track_count’ further up.

const track_count = 'Number of tracks';
// then further down once the script has selected the record
let newRecordCount = r.getCellValue(track_count);

Welcome to the Airtable community!

You say that you are new to Airtable, but you do not indicate your level of experience with JavaScript or coding in general. That would be helpful.

Sean_Wilson’s suggestions to use getCellValue in order to get the field value makes sense to me. However, you state that you have already tried .getCellValue without success. What error messages are you seeing?