How to duplicate individual repeating group entries?

I have a repeating group that is getting a list of things from an external API.

The repeating group is designed to generate a specific label format using the text from the entry. However, I need to duplicate the thing depending on a value from the API. Example below…

A purchase order that is being received has a list of ‘Items’ purchased (Item Code, Description, Order Amount, Received Amount).

The API JSON response is the list of items on the purchase order. I can use that to populate a repeating group where every item on the order is displayed once.

What I would like to then is then take the item multiplied by the ‘Recieved Amount’ so that each item in the repeating group would be a separate label that can be printed and placed on the item.

I’m exploring using the List of numbers plugin, or figuring out how to generate a temporary list of things to populate the RG with, but haven’t solved it yet.

You can indeed use a list of numbers.

-in the main repeating group cells, add a list of number so there’s one for each cell.
-also in each repeating group cell, you add a nested repeating group that will actually display the items.
-The datatype will be numbers, which is the list of numbers generated from “list of numbers” element.
-The text in the nested repeating group will reference the main repeating group’s item.

Let me know if that works for ya!

This is the way, but took a little more depth in thinking on my end on how to make it work with a changing external API.

The details are:
ListOfNumbersA that has the count of the API Items (number if indivual items on the purchase order)
RG1 based on that list.
Inside of each cell in RG1 generate ListOfNumbersB with initial number that cell’s number, total count is that cell’s received number, increment 0
RG2 inside of cells in RG1 with ListOfNumbersB as data
Elements search API for that cells number and it will be repeated the number of recieved on purchase order.

The biggest issue I needed to do was figure out how to make that API list stable instead of having to search the API response on every RG cell so I dumped the API response into a custom state on the main page element and referenced everything to that.

Thanks @thekeybeats2

1 Like

Glad you got it working!

This topic was automatically closed after 70 days. New replies are no longer allowed.