Solved

Count Value occurrence based on certain attributes

  • 2 August 2019
  • 3 replies
  • 26 views

Hi Guys

I am trying to count the occurrence of a value across a large number of attributes. All the attributes have a different name, however they all have "_SIG" in their name (a value that rates significance). Ie ENVIA_SIG, WATRF_SIG etc. There are heaps of them and I want a way to just test those attributes using a wildcard of sorts.

Basically I would like to use a tester to test for the existence of the number 5 in all attributes that end with _SIG. However in the tester (or Test Filter) I have to manually add each of those attributes which is not realistic as there are over 50 of those attributes.

Any suggestions would be greatly appreciated!

Thank you

Dominique

 

icon

Best answer by ebygomm 2 August 2019, 09:13

View original

3 replies

Userlevel 1
Badge +10

If you just want to be able to filter out features that have a 5 in any one of the attributes containing SIG you could use a ListExpression populator to put all the values of Attributes that have SIG in the name into a list then use a ListSearcher to search the list for the number 5

 

You could also use an AttributeValidator, this will let you select all the attributes to validate against the same rule (but does mean you have to select them, so not as dynamic as the above solution) - and you have to check for not 5 ( [^5] ) so that any feature containing 5 will come out the failed port

 

If you just want to be able to filter out features that have a 5 in any one of the attributes containing SIG you could use a ListExpression populator to put all the values of Attributes that have SIG in the name into a list then use a ListSearcher to search the list for the number 5

 

You could also use an AttributeValidator, this will let you select all the attributes to validate against the same rule (but does mean you have to select them, so not as dynamic as the above solution) - and you have to check for not 5 ( [^5] ) so that any feature containing 5 will come out the failed port

 

Thanks heaps for your reply @egomm! The ListExpressionPopulator and ListSearcher are very fast options! I think I am getting closer to my required result. I now have a list of attributes and I can search for the number 5 with the ListSearcher, however I would like to count how many times the number five is in that list. Do you know a way I could search a list and count how many times a certain value is found?

Thanks again

Thanks heaps for your reply @egomm! The ListExpressionPopulator and ListSearcher are very fast options! I think I am getting closer to my required result. I now have a list of attributes and I can search for the number 5 with the ListSearcher, however I would like to count how many times the number five is in that list. Do you know a way I could search a list and count how many times a certain value is found?

Thanks again

So managed to answer my own question here - @egomm set me on the right path (thank you) and I just added in a ListHistogrammar, another ListSearcher (to find the list element that had the count of the value 5) and then an attribute creator that use the list_index to pull back the count. Then repeat for all other values I want to summarize.

 

 

Reply