Repeating group with static data

Hi,

Is it possible to create a repeating group by providing it static values (without it going to the database to fetch the answer).

Well, the way you’d do this is just by placing all the static content on the page explicitly using text elements and such. What’s the use case you’re picturing?

Yes, an example is the “List of Numbers” plugin from the toolbox, that you drop on the page on reference in a repeating group.

Hi @andrewgassen,

I am builidng an ecommerce store and wanted to build the category pages with a static list of products (so it loads faster vs. fetching products using a “do a search for”).

Best,

If you save the products to the category as a list, you can display Category’s Products in the Repeating Group, instead of searching. It’s just marginally quicker though, and if you need to filter the products, it will be slower, as you will have to use the :filtered function.

Thanks @petter - exactly how I do it now. But the page load is still slow (especially on mobiles).

I have considered hard-coding every product in static groups, but I like repeating groups vs. static groups - because then I dont have to change each group if I change something in the design in one of them.

I don’t believe this is possible. The situation you’re describing is the exact use case for a repeating group pulling from the database. If it’s loading too slow for you, there may be other reasons.

2 Likes

Yes, I would look at your database first off.

How about a list of lists, where the secondary list is really just a delimited text.

For example, a Toolbox Expression, set its result as text list, and put in:
["Deluxe fishy chair|58.99|Carved teak with anchovy scratch and sniff",
"Box chair|32.99|Boring-ass square shape for flat buttocks"]

This “big list” could be loaded in one database operation.

Then the repeating group would be of type text, the data source takes the expression’s list.

Then in each cell use the regex extract
[^\|]+?
to pull the delimited fields into a real text list. Its a little clumsy, extracting the whole list every row; or a nested RG can store the extract result.
To get pictures, could include a url in the list, and give it to an image element…

An example…
[editor]
[runtime]

https://s18.postimg.org/6yahkirjt/product-list.png

2 Likes

@mishav brilliant. You are super!

I came up with a slightly different method …

A list of texts, each text being another list of texts that can be parsed directly.

["[\"Deluxe fishy chair\", \"58.99\", \"Carved teak with anchovy scratch and sniff\"]",
"[\"Box chair\", \"32.99\", \"Boring-ass square shape for flat buttocks\"]"]

It looks more complex, but only because of needing to escape everything in the secondary list.

Then inside the RG cell, instead of a regex extract, put in another Expression element, so there is a list of field texts available.

I updated the same demo app as before, with a link to the alternative method.

I tested both with 200 rows; the new method is a little faster than using regex extract for every field.

2 Likes

sehr schoen. clever @mishav

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