Forum Academy Marketplace Showcase Pricing Features

Show list/array data in repeating group

I got data in a list/array format and I want to fill a repeating group with each datapoint from this array.

The solution I’ve right now is to solve it like this (see below); where I made 3 repeating groups calling each field individually. However I like to have this result using one repeating group.

Thanks in advance

Can you set the RG to be the data type that contains all of these fields, a search for all items, and then in the cell have 3 text elements:

Current cell’s date
Current cell’s V1
Current cell’s V2

Or am I not understanding the structure?

I don’t fully understand what you mean I’m affraid @romanmg :sweat_smile:

I can select dates in a search, but then I can’t choose V1 and V2 anymore

gives me only the dates

No prob! Let’s get this figured out. What data type are the dates and v1/v2 a part of? Or are they field values in different data types?

If they’re all in the same data type, that’s what the RG should be set up to display - a list of that data type. Each text element in the cell would then display a different field value.

this is how it is stored in the database. Different field values in different data types I guess, although they are all numbers. How to set up a list of this data-type?

and

Ah, ok. We can work around this, but will take some crafting - do you have a link to share? I think that’ll be easier to work through.

Essentially your RG needs be a list of one of those fields in order for each cell to be 1 item in the list, and then you’ll search the database to grab the other values using the index #. So, if we were to work from what you started - a list of datevalues only - the other 2 text would be:

search for user_usage_from_API:first item’s expected_usage:item# current cell’s index
search for user_usage_from_API:first item’s usage:item# current cell’s index

Both of those searches need to have user_id = current user’s id so that we’re retrieving the correct data entry.

So those searches mean you’re doing a database wide search for the entry with the correct user_id - the first item that matches that - then drilling down to the list field and then drilling further down to the item in that list. Cell #1 will display items #1 for expected usage and usage, cell #2 will display items #2… and so on. Since the RG is set up to be a list of datevalues - those are easier and can just be “current cell’s date values”

This is clearly a tricky route to get these lists to display, so I’m wondering if it would make more sense to split out each of these items into their own entry? So for every new datevalue/expected_usage/usage > a new User_Usage_from_API gets created… all with user_id properly assigned. That way your RG can just be a list of User_Usage_from_API with 1 constraint… user_id = current user… and then it all splits up nicely for you. These fields would, in turn, need to be single values and not list values.

1 Like

Thank you @romanmg it worked. I agree it is much better/easier to have separate rows for each item in the array, however I get the data from an API in an array format (see: Datetime array from API not saved in database) so I can’t see a way to escape from this solution right now.

1 Like