Skip to main content
Question

use testfilter on a concatenated field

  • March 24, 2017
  • 10 replies
  • 44 views

nath
Contributor
Forum|alt.badge.img+7

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

10 replies

itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • March 24, 2017

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.


nath
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • March 24, 2017

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 :-)


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • March 24, 2017

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

 

 


takashi
Celebrity
  • March 24, 2017

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.


takashi
Celebrity
  • March 24, 2017

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.

 

 


nath
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • March 24, 2017

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 :-)

 


nath
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • March 24, 2017

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.


takashi
Celebrity
  • March 24, 2017

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.

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • March 24, 2017

@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 .+


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • March 24, 2017

@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.*)