Skip to main content
Question

How to call list elements when the list is a parameter in a custom transformer?

  • November 20, 2020
  • 4 replies
  • 47 views

dhaulagiri
Contributor
Forum|alt.badge.img+4

Hi,

I want to create a custom transformer that concatenates the elements of a list entered as a parameter. This list is like: elements {0}, elements {1}, elements {2}... elements{x} and contains words. The start index is also an input parameter. As the number of items in the list varies, I created a loop where I get the index of each item.

My problem: my list $(_ list) is a parameter and I don't know how to call its elements to add them to the string I want to build.

Can you help me?

Nicolas

4 replies

danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • November 22, 2020

Hi @dhaulagiri​ 

I think the transformer ListConcatenator can be helpful for you.

Did you try to use it?

 

Thanks in Advance,

Danilo

 


dhaulagiri
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • November 22, 2020

Thank you @danilo_fme​ 

I looked at this transformer but I think it necessarily concatenates all the elements of a list. I must choose the starting index, because depending on the results of the previous treatments, I have to keep all or delete the first, the first two or the first three elements...


danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • November 23, 2020

Hi @dhaulagiri​ 

Thanks your feedback.

The custom transformer ListSlicer can be help for you.

It's possible to start a index and after create a string ( concatenated process ).

I published the parameter for start index and used before the transformer ListElementCounter ( to get the number of list element generated ).

ListSlicerAttached the Workspace.

 

Thanks in Advance,

Danilo


dhaulagiri
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • November 25, 2020

 Thanks @danilo_fme​ , this is exactly what I need! I hadn't seen this transformer at all.

But if this solution solves my problem, it doesn't answer my question: I would like to know how to refer to an element of a list passed as a parameter. It might help me one day or another. Anyone know?


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