Shift Element Count

I have a fake “PDF” created in bubble, using a number field for page number and a text field for content. These are displayed within a repeating group. The issue I am having, is that I want to be able to ‘insert’ a new page mid-way in the big list of pages. For example, I have 6 ‘pages’:

Page 1
Page 2
Page 3
Page 4
Page 5
Page 6

where each are a data entry. what I want to know is how to insert a new data entry, replacing the page # field and shift all entries’ page numbers above where I want to insert a data entry. So, if I want to create a new entry in between page 3 and page 4, the new repeating group would look like

Page 1
Page 2
Page 3 ← Newly created data entry
Page 4 ← Previously Page 3
Page 5 ← Previously Page 4
Page 6 ← Previously Page 5
Page 7 ← Previously Page 6
etc…

Can this be done via scheduled workflows? or an easier way through normal workflows?

Do each of your “pages” exist in your database with a page # number field?

Assuming you have a data type called PAGE and PAGE has field NUMBER as a number field.

Start a workflow. Then within the workflow your first action should be “Make changes to a list of things” Set the Data Type to be PAGE. Then set the “list to change” to "Do a search for PAGE (sort it by NUMBER and set descending = “no”):item’s from (whatever stores the value of the new page number ex: Input page number’s value). Then set the field that you are going to change to NUMBER and set that equal to this PAGE’s NUMBER + 1.

Then add another action to create a new thing and create a new page with the desired page number and text.

One last thing, on your repeating group make sure you are sorting it by NUMBER and its not descending.

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