When the data from the table is retrieved through the API, the field order (columns) don’t always come in in the same order that is in the view. For instance, if I have Column1, Column2, Coulmn3 in that order in the Airtable, it might come in with Column3 first, then Column1 second, and Column 2 last.
I am using the standard code from the API page and this to display the results:
const allRecords = records.map((record) => record.fields);
console.log({ allRecords });
It appears that if I make a new table and make the fields it will work. But when the fields (columns) are modified, like change the order or delete columns or add some in, the order gets messed up.Specifying what fields to get doesn’t seem to help.
I made a new table with three columns, put data in, it read it correctly. I added a 4th column, then moved it over between the 2nd and 4th columns and it still shows the original order I created the table in with the newly created column that I moved last.
Can’t say I can find something consistent. I made another new table with 3 columns. Put data in all the boxes but one. It read it as the 1st columns, then 3rd, then 2nd.
Thanks,
Russell
using:
console.log(‘Retrieved’, record.fields);
The order of the fields in the in the view is (left to right): Name, IN, Location, Out Time, In Time.