Skip to main content
Question

How do I find values in a list searcher

  • October 24, 2017
  • 3 replies
  • 242 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?

3 replies

danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • 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


danilo_fme wrote:

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
  • 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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings