Skip to main content
Solved

Querying lists based on attribute values

  • September 8, 2020
  • 5 replies
  • 373 views

declancoleman1
Contributor

I am currently looking for a way to query a list to either return all the values that contain the value found in an attribute or return the list index for these values.

 

I have currently managed to return the list index for the first value in the list to meet this query using a ListSearcher but can't seem to figure out how to return all values.

 

Best answer by bwn

If you are like me and too bad/too lazy to write Python then an alternative would be as below.

 

This is the quickest way I know of that is stock Transformer based. You can minimise the amount of processing time that ListExploder takes by first removing all attributes that aren't absolutely needed using an AttributeRemover, leaving just a Unique Row ID and the List to Search itself.

capture

 

 

In this example I just kept it simple and searched for a RegEx expression of "1" and it returned in a Separate List all the List Indices that had the value of 1

capture1

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.

5 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • September 8, 2020

If you don't want to explode the list (and you probably don't looking at the length) then you're probably looking at a python solution


Forum|alt.badge.img+2
  • 1891 replies
  • September 8, 2020

@declancoleman1​  I agree with @ebygomm​  You'll probably have to develop a short Python script. There is a simple example that is part of the Advanced Attribute and List Handling Course, at the end of the chapter Transformers for Working with List Attributes - section Python & List Attributes and the example workspace Python_example_2020.fmwt


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • 562 replies
  • Best Answer
  • September 9, 2020

If you are like me and too bad/too lazy to write Python then an alternative would be as below.

 

This is the quickest way I know of that is stock Transformer based. You can minimise the amount of processing time that ListExploder takes by first removing all attributes that aren't absolutely needed using an AttributeRemover, leaving just a Unique Row ID and the List to Search itself.

capture

 

 

In this example I just kept it simple and searched for a RegEx expression of "1" and it returned in a Separate List all the List Indices that had the value of 1

capture1


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • 562 replies
  • September 9, 2020

@declancoleman1​  I agree with @ebygomm​  You'll probably have to develop a short Python script. There is a simple example that is part of the Advanced Attribute and List Handling Course, at the end of the chapter Transformers for Working with List Attributes - section Python & List Attributes and the example workspace Python_example_2020.fmwt

@Mark Stoakes​ just a note that the Links and Attachments on those two pages are unfortunately broken :(


declancoleman1
Contributor
  • Author
  • Contributor
  • 1 reply
  • September 9, 2020

This did the trick perfectly thanks a lot!