Hi All,
I am having an issue with my script:
When using an integer value in the condition, the script works.
Example: return all records that have a value higher than 9 in the field name "Bedroom":
const propertyTable = base.getTable("Listing");
// Read the data from my Listing table
const recordsFromproPertyTable = await propertyTable.selectRecordsAsync ();
//Filter records matching a condition
const matches = recordsFromproPertyTable.records.filter((records)=>{
return recordsFromproPertyTable.records.find((potentialmatch)=> {
return records.getCellValue("Bedroom") > 9;
}
)
})
console.log(matches)
When trying to match the field value with a single select or multiple select field, I am getting the following error:
This condition will always return 'true' since the types and 'string' have no overlap."
I am pretty sure this is due to the fact that I am comparing an Array with text but I am not sure how to solve this:
Return all records that have a value of "Villa" for the field name "Property type" (Single select field type)
const propertyTable = base.getTable("Listing");
// Read the data from my Listing table
const recordsFromproPertyTable = await propertyTable.selectRecordsAsync ();
//Filter records matching a condition
const matches = recordsFromproPertyTable.records.filter((records)=>{
return recordsFromproPertyTable.records.find((potentialmatch)=> {
return records.getCellValue("Property type") === "Villa";
}
)
})
console.log(matches)
Any help would be immensely appreciated.