Question

Filter group attributes


Badge

Hello,

 

I need to filter the Attribute values into separate groups. See the image.

The values are always variable/different so I cannot use an AttributeFilter.

Any Idea?

Thanks


19 replies

Userlevel 4
Badge +30

Hi @terezia86

If you use the transformer Aggregator with list attributes enable?

 

Thanks,

Danilo

Userlevel 4
Badge +30

Hi @terezia86

If you use the transformer Aggregator with list attributes enable?

 

Thanks,

Danilo

Another alternative is the transformer DuplicateFilter.

Badge

Hi @terezia86

If you use the transformer Aggregator with list attributes enable?

 

Thanks,

Danilo

Hi @danilo_fme,

I have 94 features, each of these should be filtered into one of these (in this case) 6 groups (F-...).

The aggregator made me from these 94 feature only 6 features. See on the image.

I need to get the result like from AttributeFilter, (splitted feature into a different "groups") just cannot import the "possible attribute values" as they always different.

Userlevel 5
Badge +25

What do you want to do after filtering? A lot of transformers have a Group By option which is designed for exactly these kinds of circumstances.

Badge

What do you want to do after filtering? A lot of transformers have a Group By option which is designed for exactly these kinds of circumstances.

Hi @redgeographics,

After filtering, need to calculate which of these features in each “group“ is the longest one. The features are polylines, and for each feature have attribute with lenght value. (After that to the longest one add another paralel polyline.)

Userlevel 1
Badge +10

If you want to keep only the longest line in each group, if you sort by the length in descending order, then use a DuplicateFilter with the key attribute set to src you will keep just the longest line for each src value

Badge

If you want to keep only the longest line in each group, if you sort by the length in descending order, then use a DuplicateFilter with the key attribute set to src you will keep just the longest line for each src value

Hi,

I need to keep all of the features, not only the longest one.

Userlevel 1
Badge +10

Hi,

I need to keep all of the features, not only the longest one.

Then I'm not sure what you are trying to achieve. But dynamic filtering is not going to be the answer.

 

Either you want to do something different to each group, in which case you need to know the groups values so you know what process to apply to each.

 

Or you want to do the same thing to each group, in which case it's likely that this can be achieved with a Group By option as mentioned by @redgeographics

Badge
Then I'm not sure what you are trying to achieve. But dynamic filtering is not going to be the answer.

 

Either you want to do something different to each group, in which case you need to know the groups values so you know what process to apply to each.

 

Or you want to do the same thing to each group, in which case it's likely that this can be achieved with a Group By option as mentioned by @redgeographics

Hi @ebygomm,

thanks for answer

ok, let me explain more.

I have these 94 features-lines (in this case), each of this lines belongs to the one of these 6 groups/src (in this case). The cases are always different, thats why it has to be flexible! After filtering the features into the groups, need to find out which of these featues in each group is longer than 1 km. Only the longest one, even there will be more than just 1 which is longer than 1 km, becommes 2 extra polylines XY. All other polylines become only 1 extra Polyline X. And this must be done for all groups. So I need to keep all features.

 

Hope it helped

Badge +2

If your values are dynamic then you can use InlineQuerier too. Example of workbench is provided in another thread...

 

https://knowledge.safe.com/questions/115062/splitting-single-input-into-multiple-outputs-for-p.html?childToView=115091#answer-115091

Badge

If your values are dynamic then you can use InlineQuerier too. Example of workbench is provided in another thread...

 

https://knowledge.safe.com/questions/115062/splitting-single-input-into-multiple-outputs-for-p.html?childToView=115091#answer-115091

Hi @pratap,

thanks for your comment.

I tried to use an InlineQuerier, but umfortunately it did not work. Happend nothing, the attributes were not sorted in groups. Maybe just wrong setting? How to achieve here the group settings?

Thank you

 

Badge +2

Hi @pratap,

thanks for your comment.

I tried to use an InlineQuerier, but umfortunately it did not work. Happend nothing, the attributes were not sorted in groups. Maybe just wrong setting? How to achieve here the group settings?

Thank you

 

Hi @terezia86,

 

Your query says to pass all attributes as-is.

 

"Select distinct src, tgt from output" then you will get unique combination of src+tgt.

"Select distinct src from output" then you will get unique values of src

Badge

Hi @terezia86,

 

Your query says to pass all attributes as-is.

 

"Select distinct src, tgt from output" then you will get unique combination of src+tgt.

"Select distinct src from output" then you will get unique values of src

Hi @pratap,

thanks, once more.

I do not know, maybe am missing something here?

I changed the setting as you wrote to only "Select " src" from output, but the result is the same, no groups, in fact here happend anything. Is this transformer really the right one to group the attributes?

Badge +2

Hi @pratap,

thanks, once more.

I do not know, maybe am missing something here?

I changed the setting as you wrote to only "Select " src" from output, but the result is the same, no groups, in fact here happend anything. Is this transformer really the right one to group the attributes?

You have missed the word "distinct"

Attached sample for reference

17jun2020.fmw

 

Added other option as well

Badge

You have missed the word "distinct"

Attached sample for reference

17jun2020.fmw

 

Added other option as well

all right! now I see what we have achieved :-)

But unfortunately, this is not what I need. I need all my features (94) to be filtered in 6 groups. To keep all the features.

 

Exactly the same what the AttributeFilter is doing, just I cannot define the "src" value before, because the value always different.

Thank you very much for your comments.

Badge +22

It would be helpful to share a workspace with your processing after the AttributeFilter (hard code it for now).

 

 

I suspect that @ebygomm's solution or something similar (sorter, sampler with group by) will be the way to go.

 

 

You say (per group) the longest polyline greater than 1km becomes two extra, but how is that accomplished?
Badge +2

all right! now I see what we have achieved :-)

But unfortunately, this is not what I need. I need all my features (94) to be filtered in 6 groups. To keep all the features.

 

Exactly the same what the AttributeFilter is doing, just I cannot define the "src" value before, because the value always different.

Thank you very much for your comments.

Hi,

Does this mean, you have dynamic values but data has to be split based on some attribute...

For understanding your question better. you want to use attributefilter with dynamic values/not predefined values. Am I right?

 

If the above explanation is correct then you can use aggregator with groupby option additionally you can use generate list option for retaining remaining attributes. with this all the similar group will make to one feature like multigeometry feature. Later you can use ListExploder...

Badge

Hi,

Does this mean, you have dynamic values but data has to be split based on some attribute...

For understanding your question better. you want to use attributefilter with dynamic values/not predefined values. Am I right?

 

If the above explanation is correct then you can use aggregator with groupby option additionally you can use generate list option for retaining remaining attributes. with this all the similar group will make to one feature like multigeometry feature. Later you can use ListExploder...

Hi @pratap,

yes, you understand it well. Thanks.

I tried it as you suggested.

Anyway I am not sure if this way is the correct way to acchieve what I need. I aggregated the features into the "groups" with aggregator (by using group by "src" and using generate List).

I´ve bekomme 6 "groups" as you can see on the pic2.

My next step should be: in each group, to work with the lenght of each feature. To find out which feature is longer than 1 km etc. In this case I cannot work with each feature, because as you wrote the "groups" are made of multigeometry feature..?

I need to have all features as they are, but in groups filtered...(something like fanout, but transformer, not writer)

After applying a ListExploder I get back all features, but unfortunattely as lenght Values were overwritten by the value from "group feature" . see the pic3.

 

 

Badge +2

Hi @pratap,

yes, you understand it well. Thanks.

I tried it as you suggested.

Anyway I am not sure if this way is the correct way to acchieve what I need. I aggregated the features into the "groups" with aggregator (by using group by "src" and using generate List).

I´ve bekomme 6 "groups" as you can see on the pic2.

My next step should be: in each group, to work with the lenght of each feature. To find out which feature is longer than 1 km etc. In this case I cannot work with each feature, because as you wrote the "groups" are made of multigeometry feature..?

I need to have all features as they are, but in groups filtered...(something like fanout, but transformer, not writer)

After applying a ListExploder I get back all features, but unfortunattely as lenght Values were overwritten by the value from "group feature" . see the pic3.

 

 

You have used only src attribute in lists... Use "all attributes" options

I have attached a sample with LEN attribute for review ...

18jun2020.fmw

Reply