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

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.

4 replies

danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • 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
  • 9 replies
  • 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
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • 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
  • 9 replies
  • 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?