Looper on object list


I’d like to modify the Looper custom widget so it can loop on any object list without having to define in advance the properties of the object list.

Do you think it’s possible ?

Thanks !

1 Like

Hi @scizeron,

the issue here is not the Javascript or so, it is the condition that you have to define your inputs to the widget.

The only way I can think of right now is to make your input a plain text first and handle this text in your Javascript.

However: I recognized, that often when I want to make a Custom Widget as unspecific as possible to allow a multi usage, it gets complicated. That makes it also harder to use for othe App developers (not so intuitive to use) and harder to maintain as well.

Thats why I often just make a specific version for a specific App.

hey @scizeron , although I am complete agreement with @thorsten.langner , I think there may be another option to accomplish what you are looking for.

If I understand you correctly, you want to loop through an arbitrary object array and perform some action. Custom widgets are specific about the shape of objects passed into them, so the only way to get an arbitrary object into a widget is so flatten its fields into text and let the widget do the rest of the work. The problem with that is that the object doesn’t exist in this flattened form.

But what if you never send the object into the widget to begin with? Technically, you don’t need to. You just need to operate on the object and do so item by item. So what if you sent in the count of items in the array, instead? Then, with your actions, you could array > get from index in array > event > iteration number.

This would let you use the same looper widget for different tasks on arbitrary object arrays. Would this work?