Looper create N entries

Is there a way to use Looper to make N entries in a list? I want to call a connector function and store the result N times. The example project has a preset list with 10 items, but I can’s see a way to make a list with a variable number of items

Hi @Gary
something like this?

Regards Chris

Hi Gary, this is definitely possible. Help me understand your use-case a little and I can try to provide some logic. Can you tell me if this is accurate:

  • You have an app with a connector function. You’d like to store the result of the connector function to a new list. You’re looking for a way to represent that connector return n times in a new list.

If you could share a little bit more about the shape of data the connector function returns, and how you want to determine how long each new list I can provide some screenshots.

@ChrisF, yes exactly! How did you get that to work?

@John, I’m calling a connector function to create a serial number. I send it a part number and it sends me back an object with a serial number, part number, part description and timestamp. I then save that in an object list so I can send it to a label printer. The operators will usually create multiple serial numbers based on the lot sizes. As a work around, I’ve hardcoded numbers 1-10 and disabled numbers greater than that, but it’s super ugly.

Hi Gary,
the START-Button initializing the looper widget by pushing the first entry on the array “arr_LoopList” which is also the dropdown-list shown:

Inside the looper widget I check the length of the array against the input of your N (i_LoopMax). As long as the array is less than the loop cycles (i_LoopMax), the trigger pushes another string on the array arr_LoolList and stored the length of the array inside the variable i_ArrayLength.

Instead of the “Push On Array” function with the randomstring you can use your connector function.

Regards Chris

1 Like

Thanks @ChrisF! That’s a nice solution