Forum Academy Marketplace Showcase Pricing Features

[Challenge] - Create a new Repeating group row without database

Okay so I don’t know if this is possible or not, But I’m trying to find a way to create a new row in an RG without creating a new thing.

What I’m trying to achieve:
User clicks add line item (A new line item is added but without creating a new database entry)

Ideal concept.
Once the user has finished setting up the document they click save.

The workflow would look something like this
(1) We create a new document
(2) Add all line items to the document

Thanks in Advance
Jonathon

1 Like

You could simply include a “group” that looks like it’s part of the RG above or below the RG. Set the group to hide when visible.

As such, it’ll look to users like it’s part of the RG and it also won’t require you to create a new thing in your database.

I’m sure there are other cleaver workarounds as well. This one is likely (one of) the easiest to implement and maintain.

Im not sure I clearly understand what you mean. Would you be able to Explain a-little more.

Tank you for your help and quick response

Sure.

Add a group below the bottom of your repeating group (RG). Put elements in that group so that it looks like it’s the last line in the RG. Set the group to visible = no. And, set the group so that collapse height when hidden = yes.

Then, set a workflow so that when the user clicks “Add Line Item” you make this group visible. It’ll look to the user as if the RG became one line longer (even though it didn’t).

Then, when the user adds information to this line and clicks save, then add that “thing” to your database. And, also set this group to hidden. The RG will update to include this new thing from your database so it’ll look like a seamless experience.

Does this explanation work better?

You can absolutely do this. The question is: Does it make any sense?

Here’s how you could do it:

  • Make the RG’s source: Thing1:merged with Thing2

Of course, Thing1 and Thing2 and the RG must share the same type. (duh)

Thing1 in this case would be a database source of the shared type.

Thing2 would be a CUSTOM STATE somewhere on the page (best would be the RG itself, most likely) that is a LIST of the shared data type.

The RG will now add a row whenever a new Thing1 is created OR whenever a new item is added the Custom State’s list.

I win your challenge.

What do I get?

Adding to the mess of ideas : )

Another possible approach is to set the RG data type to a non-thing, for example number.

Add a custom state to retrieve the list of database things.
Set the RG data source to a list of numbers, of count = 1 higher than the custom state list count.
Inside the cell, set a group of type thing, retrieve from the custom state, item number being the same as the cell number.
Inside the group, you can have elements referring to the parent group’s fields.
An alternative group can be visible when thing is empty, and contain the inputs.

1 Like

My belief is that the better thing to do is to still create an object in the database for the sake of user experience. If you rely completely on states to hold the data, any data is potentially lost on a page refresh, internet connection issue, etc.

I typically do this by putting a flag on the newly-created record (ie. a yes/no field of is_incomplete = yes). (Add in logic referencing a larger object / common association for each individual thing).

Then, when a Submit button is clicked, I have a “Make changes to a list of things” workflow that changes all of the statuses to “no”. (Or, if converting the placeholder records into another type of record, run an API workflow on a list). (You can also run logic to say when a newly created record is incomplete (ie. fields empty), that it be discarded).

If the user abandons the page, you can control the user experience (either still display the records when they come back or have a workflow that deletes all of the abandoned records).

2 Likes

I love your approach @dan1 but I’m lost on the quote above. Can you explain please?

Sure. Let’s say the thing here is an invoice. Each line item (the repeating group records) has a parent:child relationship with the invoice.

In this case, the invoice serves as the larger reference object for each of the different line items, giving them all something in common.

1 Like

Got it. Thanks @dan1

1 Like

Hey @ItsJustBusiness
Did you build that table in your screenshot? Or is it a plugin that you are using?

Probably just a repeating group since they said…

I’m trying to find a way to create a new row in an RG…

This is an interesting take on this subject. The basic idea is to populate the RG with numbers and for the total number to be +1 of the total object count:

Bubble Hack: How to create a tile repeating group with an option to add a new item

How is that different from the technique described above?

It allows you to display different content on the added row

I thought that’s what was meant by…

An alternative group can be visible when thing is empty, and contain the inputs.

It’s a helpful screencast for sure, but it seems to be showing how to implement what’s already described above.

Just realized that. You are right :+1:

In fact, given the date of this thread, the date of the screencast, and the fact that @mishav wrote the plugin used in the screencast, I’ll go out on a limb and speculate that this thread is what inspired and informed the screencast.

Just goes to show, though, that video (or imagery more generally) can be a more compelling medium to convey concepts. :wink:

1 Like

Likely!

What if you want to add more than 1 “add line item”, how would you go about setting that up?