Skip to main content

Hi,

Can i use a testfilter on a concatenated field?

For example

record1 = concatenated field contains "Aqf; Aqf,"

record 2 = concatenated field contains "Aqf; Mrl, Mrl"

record 3 = concatenated field contains " Als; Als"

I would want a filter that gives me all records where the value in the concatenated field is the same (Aqf: Aqf) and "Als: Als) or i want to have the records where one of the values of the

concatenated field is Aqf

The concatenated field is already the result of a list.

Hi @nath for the fixed values its a matter of defining the test clause, for the second test have a llok at the contain and IN operators.

Hope this helps.


Maybe it's a stupid question but i don't know how to define the cause for the first one. I can compare with other values in other records but not whitin the same record in the same attribute? This doesn't work :-)


Maybe it's a stupid question but i don't know how to define the cause for the first one. I can compare with other values in other records but not whitin the same record in the same attribute? This doesn't work :-)

something like this?

 

use-testfilter-on-a-concatenated-field.fmw

 

 


Hi @nath, If I understand the requirement correctly, this works.

  1. AttributeSplitter: Split the concatenated string into individual elements and save them in a list attribute.
  2. ListRangeExtractor: Extract min and max from the list.
  3. Tester: Filter the features with testing min = max .

If there could be several kind of delimiter character (e.g. comma, semicolon, and colon), you can use the StringReplacer (regular expression mode) to unify the delimiter characters to an identical one (e.g. comma) beforehand.


Hi @nath, If I understand the requirement correctly, this works.

  1. AttributeSplitter: Split the concatenated string into individual elements and save them in a list attribute.
  2. ListRangeExtractor: Extract min and max from the list.
  3. Tester: Filter the features with testing min = max .

If there could be several kind of delimiter character (e.g. comma, semicolon, and colon), you can use the StringReplacer (regular expression mode) to unify the delimiter characters to an identical one (e.g. comma) beforehand.

The workflow looks like this.

 

 


Maybe it's a stupid question but i don't know how to define the cause for the first one. I can compare with other values in other records but not whitin the same record in the same attribute? This doesn't work :-)

 

Thx but i have a thousand differents combinations and i can't all define them in the filter :-)

 


Thx, i think that would work if i have two values in the concatenated field, but what if there are more? 3, 4, 5, it's for each record different.


Thx, i think that would work if i have two values in the concatenated field, but what if there are more? 3, 4, 5, it's for each record different.

That's the reason why I suggested the ListRangeExtractor use here. Regardless of the number of elements within the concatenated string, once you have saved them into a list, you can use the transformer to extract the minimum value and the maximum value from the list. You can therefore determine if all the elements are identical with just checking the min and max.

 


@nath

Use a regular expression (.+;\\s\\1)|(.*Aqf.*)

in Tester

[{(.+;\\s\\1)|(.*Aqf.*)} {YourAttribute}] = 1

Or in string searcher

(.+;\\s\\1)|(.*Aqf.*)

(u have a space after the semicolon, that's the reason for the \\s in the expression)

\\1 is the first capturegroup wich is the .+


@nath

...correction first capture group is in parentheses so...

(.+);\\s\\1

To complete correction...add wordboundaries \\b )works now a days in stringsearcher..)

(\\b.+\\b);\\s*\\1$

And when repeats more the 2 times..

(\\b.+\\b);\\s*(\\1,*)+$

So total regexp would look like

(\\b.+\\b);\\s*(\\1,*)+$|(.+;.*Aqf.*)


Reply