CODA API - Get Table Row Values

I want to get the values of each row in a table. Below is my initial code.

var rows = CodaAPI.listRows(CODA_DOC_ID , TABLE_ID).items;
for(var i=0; i<rows.length;i++){
    console.log(rows[i].values);

}

rows[i].values contains the information below:

 { 'c-hSzeG0KiHu': 'Alaska',
   'c-OQYKaHBqgN': '2022-08-05T00:00:00.000-07:00' }

From the information above, I just want the information ‘Alaska’ and ‘2022-08-05T00:00:00.000-07:00’ . I want to get the information . How will I do that ?

1 Like

Hi @Alyssa_Gono, you should be able to use the Object.values() method to get those values from the object. In this case, you could write the following code to get Alaska and 2022-08-05T00:00:00.000-07:00 from the rows[i].values object:

let myValues = Object.values(rows[i].values);
myValues.forEach((myValue) => console.log(myValue));
2 Likes

Wow, thanks for the help!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.