Add Row in Custom Action

Is it possible to choose “Add Row” in a custom action and then use the new RowID from that row to add another row in a different table? If so, how would that work?

I struggled with this because I bet you want to reference back to the new object/row.

I ended up using @Robert_Petitto technique for creating your own “form add” with the twist that I create a “uniqueID” and store it in the “working table” before collecting the input. Then I used the uniqueID as the identifier instead of the RowID.

I use it in about 10 relations to track interconnections between meetings/feedback/agendas/tasks/posts etc and it works well.

Hope this makes sense.

1 Like

Thanks Matt. I’m not quite sure what you’re saying. Here are some more specifics of what I’m trying to do:

  1. I have a conference, people and attendees table (with the attendees as the join between conference and people)
  2. On the conference screen I have an add attendee button which opens an attendee form. This has a choice component to select a person.

But I want to add a button on that screen to add a new person, capture the rowid of the new person and add it to the attendee table for the given conference.

Does that make sense? Any suggestions?

This is exactly what I do whenever I need to create a parent record, and add one or more child records in the same step.

1 Like

Could you leave here the link to that solution? Is what I’m trying to do but without more information is not possible to follow your logic.

Thanks

There is no link to the solution - hopefully this makes sense. Plus @Robert_Petitto has an excellent video on working tables.

Here is the technique based on the original example:

There are 3 tables (People, Conference, Attendee). Attendee table has two columns: People-ID and Conference-ID. Currently People-ID is the ROW ID from the People table.

The goal is to Create a new “People” row and Add that “People” to the Attendee table all from one screen. Basically, Add Row to People table (creating a new ROW ID) then Add Row to Attendee table (using the ROW ID from newly created row within the People table).

Problem:

You can not capture the ROW ID for a newly created row (People) during an action. So you can not use the People ROW ID when you Add Row to the Attendee table.

Solution:
DO NOT use ROW ID as the Identifier for a PERSON in the People table, CREATE your own identifier using Glide’s built-in “Unique identifier” field.

This requires setting up a ‘working table’ (which has all the fields of the People table PLUS a new column called “People ID”). Before calling the ‘Show/Edit Screen’ assign a Unique Identifier to the working table’s “People ID” column via Set Col Value. Use this working table as the ‘Data’ for the new screen.

Technique:

The steps are:

  • Create a temporary working table for People (e.g. temp-People table)
  • Setup a Button Action which:
    ** Set Column Value for People-ID in temp-People table to “Unique Identifier”
    ** Show New Screen using temp-People table
  • Collect Data for new People into the temp-People table (it already has a People-ID populated)
  • Create New ROW in People (Set Col Val with the data from temp-People table including People-ID)
  • Create New Attendee Row - Use People-ID from the working table as the People-ID in the Attendee table (replaces ROW ID)

You do not use People table ROW-ID to connect People to a Conference in the Attendee table; you use a unique identifier called People-ID from the working table.

Net/Net: You create your OWN “ROW ID” using "Unique Identifier’ and then set the column value in People Table and Attendee table to that value.