Skip to main content

Filter by two criteria

  • December 3, 2022
  • 3 replies
  • 32 views

Forum|alt.badge.img+1

Hello,

How can we do, in a script, to apply a filter that returns records that match two conditions.

My attempts :

let filteredConcurrents = query.records.filter(concurrentEdition => { return concurrentEdition.getCellValue('Edition Record Id')?.includes(editionAnumeroter.getCellValue('Record id')) }) let filteredRecords = filteredConcurrents.records.filter(catego => { return catego.getCellValue('categorie_texte')?.includes(categorie) })

Thx for your help

3 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • December 3, 2022

Can you give a bit more info? Does you code run or not? If it runs, does it show the records you expect, too many, too few, or simply the wrong records? Can you share screen shots?


Forum|alt.badge.img+1
  • Author
  • New Participant
  • December 3, 2022

Can you give a bit more info? Does you code run or not? If it runs, does it show the records you expect, too many, too few, or simply the wrong records? Can you share screen shots?


Thx for your answer.

There's an error.


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • December 4, 2022

The code in your first post does not exactly match the code in your screen shot. But they both have a similar issue. The second time you do the filtering you need to work with the previously filter array. The filtered array does not have a query object or a records object.

The new forum software does not let me type code properly on my phone, and won’t let me edit pasted code.

In this line, remove the ".records"

let filteredRecords = filteredConcurrents.records.filter(