Appending fields from several records coming from filtering pipe

@Chem @moe
Hi, I was working with the filtering by one field pipe and in my app, the pipe returns several records. I need field_197 (in my example) values from all the filtered records, and appending all in a string separated by /. This appended string should be the response to be used as the pipe value to set another field in the table. Any suggestions?

Hi @Aprada; I’d love to assist with this. It seems as though a Rollup field might work for your case or a custom script. Any chance you can send an example/use case of what you’re trying to accomplish so I may assist you better? Thanks! :smiley:

Hi Chem, thank you for fast reply. I was working with some script to do that, checking the new debug feature in pipes, and some trial & error. In the end, I could get a working script that I set as a table rule in table1. So every time a record is edited in table1, the script checks this record ID in the second table table2, make and sort the json with all the selected records that match this record ID in 1 selected field of table2 (field_197) and a second field of table 2 to sort (numeric field, field_219), and gets the values from property of field_197, and join all of them as a string using “/”. using the map and return functions, the script takes the final string as a “response”, and that can be used in the table rule as “set fieldXX as the pipe value of response”

//Headers
var appId = '{appId}';
var apiKey = '{apiKey}';
var apiSecret = '{apiSecret}';

//Parameters
var tableId = '{tableId}';
var field_id = '{field_id}';
var field_val = '{field_val}';
var operator = '{operator}';
var order = '{order}';
var order_by = '{order_by}';
var recordId = '{recordId}';
var tableId2 = '{tableId2}';



//Hago consulta por filtros
var settings = {
  "method": "GET",
  "headers": {
    'X-Tadabase-App-id': appId,
    'X-Tadabase-App-Key': apiKey,
    'X-Tadabase-App-Secret': apiSecret,
  }
};

const url = "https://api.tadabase.io/api/v1/data-tables/{tableId}/records?filters[items][0][field_id]={field_id}&filters[items][0][operator]={operator}&filters[items][0][val]={field_val}&order={order}&order_by={order_by}";
var res = UrlFetchApp.fetch(url, settings);
var items = JSON.parse(res.getContentText())["items"];

items.map((item)=>{return item["field_197"]}).join("/");
1 Like

sorry but I cannot set the “´´´” to show the code with format