Help

filterByFormula that is linked from other Table

Topic Labels: API
2831 1
cancel
Showing results for 
Search instead for 
Did you mean: 
John_Himics
4 - Data Explorer
4 - Data Explorer

I have records that look something like this in Employee table.

“records”: [
{
“id”: “recxPbyRYLea1Y3u7”,
“fields”: {
“Name”: “Jane Doe”,
“ID”: 1,
“Roles”: [
“rec93YegEkI0lLKi0”,
“recgUgOR7mEk9SYDm”
],

}
}
]

As you can see Roles link to other Table, so what I wanted to achieve is that filter Employee data including data that is linked from another table in this case Role.

e.g. I wanted to show all Employee with Roles Id of ‘rec93YegEkI0lLKi0’ using ‘filterByFormula’.

I’m using CURL PHP

Thanks

1 Reply 1
Esteban_Dalel
4 - Data Explorer
4 - Data Explorer

Hey!
I had the same problem, in NodeJS but i bet it is the same.
I had a Reserves table that was something like
{
ReserveNum:2,
User: 402123 (this is their id)
ReserveStart: June20,

}
The user was a linked record from the Users table. I just had to use their ID, not the hash code (402123 rather than “rec93YegEkI0lLKi0”
findReserveByUser:
function (userID) {
return new Promise(function (response, reject) {
base(‘Reserves’).select(
{
maxRecords: 1,
filterByFormula: “AND({User}=’” + userID + “’,TRUE())”,
sort:[{field: “ID”, direction: “desc”}],
view: “Grid view”
}
).eachPage(
function page(records, fetchNextPage) {
records.forEach(function (record) {
response(record.id);
});
fetchNextPage();
}, function done(err) {
if (err) { console.error(“error finding reserve”+ err); return false; }
}
)
})
},