Hey Artem - thanks for your response here. I had a friend who writes Javascript help me out. Because the table in AirTables has nested or 2nd level data, you need to define variables before you can use them. For anyone else trying to understand - the array that I’ve imported above has “id” and “fields” on the same level. But it doesn’t know that there is an array of items within “fields”. To pull this data out you need to write a code step. Which isn’t a difficult code step, but it’s code. So admins - this is where people who came to UIBakery because it’s No-Code are going to get lost.
To pull out the array within “fields” the code is written below:
const records = {{data.records}}
return {
records: records.map((record) => ({
id: record.id,
firstName: record.fields.firstName,
lastName: record.fields.lastName,
email: record.fields.email,
totalShares: record.fields.totalShares,
portfolioValue: record.fields.portfolioValue,
}))
}
Note that we changed to do everything in camelCase so that it would all flow. Effectively we are defining a variable e.g. “portfolioValue” as the dynamic value of the records.fields.portfolioValue array.
The variable on the RIGHT must correspond exactly (meaning it’s case-sensitive) with the name of your columns in airtable. So if you’re getting an error it is likely that you have a typo or that you’ve used uppercase characters.
Below is a screenshot showing the names of my columns in Airtable.
Hope this helps somebody out there!