Mar 15, 2022 01:33 PM
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”:
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:
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:
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
Mar 16, 2022 04:00 PM
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);
Mar 16, 2022 05:50 PM
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?