Airtable API 过滤器可返回链接实体列中具有特定条目的所有记录

问题描述

我需要能够通过公共 API(使用 Airtable.Net 客户端>)过滤 Airtable 表,以便它只返回在链接记录字段中具有特定条目的行。

该字段配置为允许多个链接记录。

我试过了:

  • import java.util.*; class multiple_harshad_NUMBER { public static void main(String args[]) { Scanner sc = new Scanner(system.in); int i = 0,s1 = 0,d = 0,s = 0,temp = 0; int n = 6804;/*lets take it as its a multiple harshad number but if you are making a program to check whether a number is multiple harshad number or not then use Scanner class.(input)*/ while (n != 0) { temp = n;/* assigning value to temp variable as n will be 0 at the end of inner looP*/ while (n != 0) {//loop for digit by processing d = n % 10; s = s + d; n = n / 10; }// inner looop close s1 = temp / s;//s1 gets the quotient if (temp % s == 0 && s != 1){//condition to check if the temp(variable) is at least harshad number n = s1; s = 0; } }// outer loop close if (s1 == 1) { /*since a number is a multiple harshad number if and only if the end of the snippet is 1*/ System.out.println("Is Multiple Harshad Number"); } else { System.out.println("Isn't Multiple Harshad Number"); } } }
  • {fieldname} = "<the entity's object_id>"

并且我的工作假设是,由于所有 Airtable API 将返回链接列的对象 Id 数组作为字符串,那么这就是我要搜索内容 - 但两者都不返回行。

谁能告诉我如何构建一个过滤器公式,该公式将根据链接实体在列中的存在情况进行过滤。

谢谢!

解决方法

你们很亲近。在链接记录字段上使用 FIND() 时,您必须按外部记录(您在 UI 中看到的那个)的主要字段值进行搜索。通常,在处理链接记录、汇总、查找或其他数组类型的值时,Airtable 在公式引擎中将它们视为字符串。

如果我们以用户研究模板为例:https://airtable.com/shrmLyfKRQYHMoeyT

反馈会话表有一个链接记录字段,功能请求/投诉提及,到功能/投诉表。

如果我想要所有被标记为“更好的搜索”的反馈,那么我的 filterByFormula 值看起来像:

FIND("Better search",{Features Requested/Complaints Mentioned})

有时,您希望能够使用 FIND 并引用外部记录的底层 Airtable 记录 ID。为此,我们可以在本地表中创建一个汇总,将外部记录的所有记录 ID 串联起来。为此:

  1. 在您的外部表(本例中为特征/投诉)中,创建一个名为“记录 ID”的新公式字段并使用公式 RECORD_ID()。此字段现在将显示外部表中每个字段的基础记录 ID
  2. 在您的本地表(反馈会话)中,创建一个名为“外来记录 ID”的新汇总字段。此字段应使用链接到外部表的链接记录字段。然后选择我们在上一步中创建的记录 ID 字段。最后,公式是ARRAYJOIN(values)

现在在我们的本地表中,每个外部记录 ID 都有一个逗号分隔的字符串。因此,如果我们想使用外部记录 ID 而不是主字段执行相同的搜索:

 FIND("recvyl20eHSARMtVj",{Foreign Record IDs})

搜索多个链接记录

当您只需要查找具有单个链接记录关系的本地记录时,此解决方案非常有效。如果我们需要找到所有带有“更好的搜索”或“移动应用”功能链接的记录,那么您应该使用 OR 函数将多个 FIND 函数链接在一起。由于这一切都基于检查字符串值,因此您无法保证链接记录以特定顺序表示。

这个请求:

    FIND("Better search,Mobile app",{Features Requested/Complaints Mentioned})

将仅提供链接记录具有“更好的搜索”后跟“移动应用”的记录。相反,我们想做:

    OR(
        FIND("Better search",{Features Requested/Complaints Mentioned}),FIND("Mobile app",{Features Requested/Complaints Mentioned})
    )