Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Airtable.js API _ Getting values as string

Topic Labels: API
459 1
cancel
Showing results for 
Search instead for 
Did you mean: 

Currently, I load data from my base then individually go through them individually to convert the data to strings. Is there a way to read the data as string when loading?

let people = ;

base(“Employee”)
.select({
view: “Grid view”
})
.eachPage(
function page(records, fetchNextPage) {
records.forEach(function(record) {
let pp = new person();
pp.name = record.get(“Name”);
pp.role = record.get(“Role”);
pp.cards = record.get("(Relevant) Cards");
people.push(pp);
});
fetchNextPage();
},
function done(err) {
if (err) {
console.error(err);
return;
}
}
);

class person {
constructor() {
this.name;
this.role;
this.cards;
}

formatRole(){
if(this.role != null){
let is = ;
for (let i = 0; i < this.role.length; i++) {
base(“Employee”).find(this.role[i], function(err, record) {
if (err) {
console.error(err);
return;
}
is.push(record.fields.Name);
});
}
if(is.length == 1) this.role = is[0];
else this.role = is;
}
}
}

1 Reply 1

Welcome to the Airtable community!

No, you do not get to choose the format of the data when using the REST API. This is different from using Scripting.