Cannot add rows to repeater dynamically

Hey all.
I’m trying to add rows to a repeater based on values created on another page.
I tried to do this by setting variables on the form page, and when loading the list page, it reads the current value, and adds it to the repeater (via a local variable).
It works for the first item, but subsequent items clobber the existing.

Repeater issue.rp (63.3 KB)

If I put everything on the same page (using the same logic), the behavior is fine:
Repeater issue SPA.rp (55.7 KB)


The reason it does not work is that every time you load the List page, it starts from scratch, which as you have designed it is an empty list. The same is true on your Repeater Issue SPA prototype if you were to reload the page.

So, if you really needed to add items on a separate page then you would need to keep track of each row you add in global variables, and that would eventually overflow the global variable buffer and crash your prototype. While I don’t recommend this approach, I went ahead and tried it to see if it would indeed work. It does, but be warned it should be limited–how many rows can be added may depend on the length of the items added.
Repeater issue v2.rp (73.2 KB)

  • I added two more variables to keep a running tally of each row added (by Field) such that F1Rows holds each Field 1 entered, separated by a semicolon (’;’). Same for the F2Rows global variable. In this way, each row’s data is sequentially added, using the semicolon as a “row delimiter.” (You can use a different delimiter if semicolons need to be entered as part of the field text.)

  • On the List page I added a set of “functions” and temp text widgets to help with parsing the F1temp and F2temp variables. These are grouped together in the ListHandlerGroup (which hides itself with OnLoad.) In the OnPageLoad event, the F1Rows and F2Rows variables are copied to the temp text widgets and the “Prep Items” button is fired. That button slices out the first “field 1 data” and “field 2 data” by looking for the first semicolon, and sets the Field1 and Field2 variables accordingly, then strips that out of the temp text. It then fires the “Add Rows” button which adds a row the same way you did, and fires the “Prep Items” button again. This sets up a repeating chain which continues until all the existing fields and rows have been used–ending of course with the last fields added.

Here is a more reliable solution which basically behaves the same as using a separate page–with better usability because the list doesn’t abruptly disappear when adding new row items. See the List v2 page. All that is changed from your example is that I added the “Add Item” button and put the input fields into a group which is shown when “Add Item” is clicked.
Repeater issue SPA v2.rp (76.8 KB)