Is it possible to create multiple records from one entry?

I have an expense tracking app that allows users to enter various types of trackable hours (e.g. Design hours, Travel hours, Service hours). Rather than using buttons to make Design Hour, Travel Hour and Service Hour entries, the end users have requested the ability to make the entries from one screen (versus making an entry, then pressing another button to make the second and another for the third).

Designing a screen with three sections wasn’t hard, but it inserts all of the entries into one Expense record. Is there a way to fill out one screen and have the app post the values into the Expense record as three individual records?

1 Like

Kind of, but it’s a bit of a setup. Rather than using a form, you would need to create a screen that’s solely devoted to writing temporary values to user specific columns. Then upon the button push, there would be a series of add row actions that would write those temporary values to the correct sheets and then clear the user specific columns so that way the user can fill out the form a second time if need be.

3 Likes

This is an interesting scenario @Robert_Petitto. But supposing to write in two different tables, where we have a relationship between the two, based on the rowid of one of these; since the rowId does not yet exist when you go to write in the tables, do you think there may be a way to solve this aspect too?

Hm…sorry, I’m not following.

Suppose we’ve two related sheets, and from a single entry (…from a screen that’s solely devoted to writing temporary values to user specific columns… etc.) we want to write only:
Book Name (to Books Sheet)
Pages (to Books Sheet)
Author Name (to Authors Sheet)
Biography (to Authors Sheet)

When we add the author row, we should also retrieve the author’s new RowId to add it in the book row into the idAuthor Column.


I think this is not possible unless you have found a way to do it :thinking:
You found it?

As you said this is the problem. The action might not fire slow enough for the rowID to exist and written to the second table. But would have to try to know :wink:

1 Like

Exactly.
If we had a reference in the actions, we could make a conditioned jump from one action to another according to a condition (so for example we could wait for the end of a processing, in our case represented by the appearance of the rowid).

I think my issue is similar to this - I have multiple types of users that will use the app, with different types of information in their profiles. Consumer, service provider, different type of service provider, etc… So I have a welcome screen where they enter the basic profile details, name, upload avatar, and then select their type of user from a choice box. When they select that they’re done, a new row is created in the user table, including their user type, and then the next screen appears based on the type selected. But now, based on the user type, I want subsequent profile details to be entered in a different table, relating back to the unique ID of the user. So I would have a master table of all users with basic details, and then individual tables for the respective types of user with their expanded details. I’m trying different things but am really stuck on this one LOL.

What I would do in the onboarding process is to let the user choose their profile type first, then show/hide the entry components based on that type. You can have all columns in the user profiles sheet to use elsewhere in the app, rather than creating other tables.

Thanks. Based on the number of columns I need this would be incredibly cumbersome. I solved part of the problem with Zapier, for each new User row created I can add a new row and email to a different table. Then I can relate the tables and use lookup to pull over anything I need. I have to make a zap for each User type. It’s working well, but I can’t discriminate by User type when duplicating the row, so the same info goes to every extra table. Now I have to figure out how to delete the unwanted newly created rows from the other tables. Getting there…

Edit: Using filters in Zapier I was able to prevent the redundant rows from being created. Now my issue may be the time it takes for the Glide table to update from the Google Sheet.

But supposing to write in two different tables, where we have a relationship between the two, based on the rowid of one of these; since the rowId does not yet exist when you go to write in the tables, do you think there may be a way to solve this aspect too?

You can create a column and use the special value unique id when you create the row. Than you can use this id as foreign key.

2 Likes

Bingo!
I think it can work also using a form (without a custom button push) by putting a bit of various techniques into a soup (a relation to a single row in a third table, set column uniqueID to that related row, retrieve that value and write it on first table and second table…).
I’ll write an example APP.
Thanks @Jacktools_Net this is the right direction.

2 Likes

Hi @BobbyG77

I created this copyable example APP because this scenario seems very interesting to me. In my APPs it can solve various situations, where before I was forced to resort to special functions with apps script.
It looks like it works fine, but I still don’t know how reliable it can be, take it with a grain of salt.

@Robert_Petitto , @ThinhDinh What do you think about this solution?
I thank @Jacktools_Net for giving me the right starting point.

2 Likes

Wow @Roldy, let me take a look at how this works. I see you have a custom action triggered from the on Submit function. I’ve got to study this a little more. Thanks!

1 Like

Very nice. I like that. :+1:

1 Like

Very nice. Thanks for sharing.

1 Like

After a few days of messing around with different ways to work with the multiple tables I had to relent and do as you suggested. I did learn a lot though.
Glide 1, Blake 0 :sweat_smile:

1 Like