如何过滤包含给定string的airtablelogging,但也可能包含其他logging?

使用airtable api的filterByFormula方法,我可以查询和select包含一个特定项目(string)的logging。 但是,此查询只返回只有该特定string的logging。

在这里searchairtable API公式文档: https : //support.airtable.com/hc/en-us/articles/203255215-Formula-Field-Reference没有得到答案。

我拥有的:

base('Table').select({ view: 'Main View', filterByFormula: `Column = "${myFilter}"` }).firstPage(function(err, records) { if (err) { console.error(err); reject( err ); } records.forEach(function(record) { console.log(record.get('Another Column')); }); 

同样,这将返回只有myFilter的logging,而不包含给定列中包含任何附加值的logging。

编辑:airtable指这些列为“多选”字段types。

看起来,airtable支持以SEARCHforms的indexOf的js等价物。 从文档:

SEARCH(find_string,within_string,position)
从位置开始,返回within_string中find_string首次出现的索引。 位置默认为0。

因此,我们可以使用以下作为我们的searchfilter值

 filterByFormula: `SEARCH("${myFilter}", Column) >= 0` 

这将search我们的Column myFilter的存在,并返回任何结果是myFilter位于Column某个位置。

注意:值得注意的是,你的myFilter属性可能最好至less有2个字符的性能。 该文档也没有指定不区分大小写的选项,因此,如果您想要返回结果,而不考虑大小写字符,则可能希望将Column"${myFilter}"包装在LOWER()函数中。 例如

 filterByFormula: `SEARCH(LOWER("${myFilter}"), LOWER(Column)) >= 0`