Skip to main content
Solved

table.selectRecordAsync only return primary field


Forum|alt.badge.img+2

Hello,

 

I am trying to get a field named “Statsig Url” in a table named Experiments (this is a field with the url type).

 

(My intent is to get the record id based on the value of the Statsig Url field). A filter will be applied in the url.

 

let table = base.getTable("Experiments");

console.table( await table.selectRecordsAsync( {"fields" : ["Experiment Name", "StatSig Link"]}));

console.table( await table.selectRecordsAsync( {"fields" : table.fields}));

I have tried with different approaches (testing other fields...). Each time I only get the primary key.

 

Best answer by TheTimeSavingCo

Yeah unfortunately we can’t filter via the query with the Scripting API, and so I think you’re going to have to get everything and then filter it I’m afraid.  If your values are really static then you could try to use a view for this, but probably isn’t worth the effort really

 

The Web API does let you filter, oddly enough

View original
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img+2

A workaround is  this : 
 

let query = await table.selectRecordsAsync({ fields: ["StatSig Link"] });

for (let record of query.records) {
    console.log(record.getCellValueAsString("StatSig Link"));
}

But i guess it would had been better to filter within the query


TheTimeSavingCo
Forum|alt.badge.img+28

Yeah unfortunately we can’t filter via the query with the Scripting API, and so I think you’re going to have to get everything and then filter it I’m afraid.  If your values are really static then you could try to use a view for this, but probably isn’t worth the effort really

 

The Web API does let you filter, oddly enough


Forum|alt.badge.img+2

Thank you ​@TheTimeSavingCo 


Reply