Skip to main content
Question

How do I find values in a list searcher

  • October 24, 2017
  • 3 replies
  • 301 views

I have a list as structured below.

_list{0}.Name = Apple

_list{0}.list1{0}.code.value=1

_list{0}.Name = Banana

_list{0}.list1{0}.code.value=2

How do I search using a list searcher so that I want only the results for code.value=2?

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.

3 replies

danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • October 24, 2017

Hi @vemanamanu99,

I created a Workspace example.

  1. Read a shape file and build a list of attribute ( transformer ListBuild )
  2. Search a List value ( transformer ListSearcher )

Result is the List value that contain what i want.

 

In my example the List{1} has the value 2.

 

 

Thanks,

Danilo


  • Author
  • 1 reply
  • October 24, 2017

Hi @vemanamanu99,

I created a Workspace example.

  1. Read a shape file and build a list of attribute ( transformer ListBuild )
  2. Search a List value ( transformer ListSearcher )

Result is the List value that contain what i want.

 

In my example the List{1} has the value 2.

 

 

Thanks,

Danilo

Thank you @danilo_inovacao, I will give a go ahead on this now and will reply back. :)

david_r
Celebrity
  • 8394 replies
  • October 24, 2017

Are you searching for the fruit name and wanting the id, or are you searching for the id to get the fruit name?

If you're searching for "Banana" and want the associated fruit id, here's a possibility: Assuming that the nested list "list1{}" always has exactly one element, the attached workspace will return the value "2" in the attribute "Result".

banana-searcher.fmw

If you're looking for fruit id = 2, it's slightly more complicated since you have a nested list, which the ListSearch doesn't support. Here's a possible solution:

2-searcher.fmw