Add new row and show detail screen (action)

Hey,

I have created a Screen from the “Orders” table. In the Screen I have a collection with a list of orders.

I would like to Create a new order (Add row) and view its Detail.

When I configure the Action, the new row is added, but I get the Detail of the first row of the Orders table. I would like to display the Detail of the added row. Any tips?
Snímek obrazovky 2023-03-22 v 11.38.49

I have this exact case. (except I am using the Show Edit Screen). Glide needs to give a method to select the new row that has been added instead of keeping the target as this item. Maybe an option on the Add Row to change “This Item” to new row.

My use case is I have a row that contains a description contained in the row. Often the description is as simple as “Group 1”, when I add the new row I want to change that description to “Group 2”. With the current “This Item” staying on the row that copied I end up changing the wrong one.

Now I just tell my client to start with the description of “Group 2” then on the copy they change the 2 to a 1 and thing look better in my collection.

Can you explain your use case? How is your “add row” action related to the “Show Edit Screen” action?

Simply I want to add a row (copy the This Item in the action) and then edit the newly created row, not the row I copied.

A similar use case to what I actually am doing follows. Obviously my real world example is more complicated with a lot more data.

I have a list that is sorted via a time stamp that the user enters. Rows may have a time stamp that is the same. My data looks like this in the table.

Row Timestamp Description

10 Feb 21, 2024 10:00 Group 1
11 Feb 21, 2024 12:00 Group 1
12 Feb 21, 2024 11:00 Group 1

On the screen the data is shown in a List component like this (sorted by timestamp)

10 Feb 21, 2024 10:00 Group 1
12 Feb 21, 2024 11:00 Group 1
11 Feb 21, 2024 12:00 Group 1
and on each row there is action to copy that row. The action is like Josef_P’s above except I use a Show Edit screen. The user wants a row like row 12 so they select that row and copy it (add a row like 12).

My data in the table now looks like this

10 Feb 21, 2024 10:00 Group 1
11 Feb 21, 2024 12:00 Group 1
12 Feb 21, 2024 11:00 Group 1
13 Feb 21, 2024 11:00 Group 1
The “This item” in the action is still pointing at row 12 so the edit screen shows row 12 data. But the user does not know it and really probably thinks it is the new row. They edit it, changing Group 1 to Group 2. So my data in the table is now
10 Feb 21, 2024 10:00 Group 1
11 Feb 21, 2024 12:00 Group 1
12 Feb 21, 2024 11:00 Group 2
13 Feb 21, 2024 11:00 Group 1

They close the edit screen and the data in the List component is

On the screen the data is shown in a List Component is like this
10 Feb 21, 2024 10:00 Group 1
12 Feb 21, 2024 11:00 Group 2
13 Feb 21, 2024 11:00 Group 1
11 Feb 21, 2024 12:00 Group 1

Not really the desired result. Because I would like it (and I a pretty sure the user expects it) to be

10 Feb 21, 2024 10:00 Group 1
12 Feb 21, 2024 11:00 Group 1
13 Feb 21, 2024 11:00 Group 2
11 Feb 21, 2024 12:00 Group 1

And since there is only one column I can sort on in a list I cannot change the order to the desired order. I cannot concatenate the data in a sortable way because one is date/time and the other is text.

If I could have specified to change “This Item” to be the copied row (row 13) it would have worked perfectly and more inline with what a user would have expected.

I feel like this could be simplified quite a bit. For one, why use an Edit screen for an existing item if you are not going to edit that existing item. To me, it would make a lot more sense to use a form screen with default values set on each component based on the original item. Then the user can simply click a button to open the form screen, modify whatever they need to in the form, submit the form, and only then will the new row be added. No need to duplicate a row and then try to figure out how to get to that duplicated row to then update it. Do it all in one shot with one form.

As for sorting, you could still easily sort by multiple values. I would first use a math column to get your date in a YYYYMMDD format, then use a template column to joined the group name and date together into a single string. Then sort by that template column.

3 Likes

Ahh…. My misunderstanding how each type of screen works. This is what I think now

Edit screen - use this on item that exists, submit then just sends it back to the this item - one per table

Form screen - use this to edit a new item, can initialize in some way, submit makes a new row in the table. One per table

Detail screen - view item one per table

New screen - just another view on the item. Many per table. Add your own buttons to do what is needed. Or whatever.

I will try out your suggestion. I do not need the sort I just thought that might be a way to sort them to work around the issue.

Is there a way to look for all form screens one has used in app. I would think not.

2 Likes

Not easily, unless you know of a common column that is used in multiple form screens, then you can use the Find All Uses feature for that column.

Form screens are usually independent based on where they are opened. The same form screen is not usually shared in multiple places, except for cases like yours where you would be opening a form from a collection. In that case, every item in the collection would open the same form.

Once again you help me. Thank you. Will let you know how it turns out.

1 Like

I am not understanding why this is not working.

I have a screen of buttons which use data from a table called Admin

Untitled

I click on the manage Sessions button which is setup like this.

Untitled

This takes me to a screen with a collection like this

Untitled

The collection is setup as follows

All the actions are from the ellipsis on this screen are setup like this

The edit action sends me to a edit screen that shows me the data from the row I executed from.

But the show form screen sends me to a form screen that is the row from table at the push button level, that is, Admin.

Got any ideas

Do you have the source for the form set to the correct table? Can you show the form configuration?

Here is the setup for the form screen

Untitled
Copy Session action

There is no place to set what it acts on so it must act on This Item. The Edit Action setup is

Untitled 2

For it I can specify the data source.

Open the form. Then you can set it’s source table. You don’t set it in the action, you set it in the form. I want to see the form configuration. Not the action configuration.

Forms are completely independent and can write to any table you choose by setting the correct source table.

Thanks. That is the issue.

It is on wrong table. I am not sure how I have been doing development for as long as I have and not seen this (or forgot). When the form page is opened on the builder it comes up on the Option page so, which is weird. Maybe that is why I have done most of my data entry without using forms.

By the way, do you ever sleep?

2 Likes

What is this sleep thing you speak of?

1 Like

It defaults to the first table listed in the Data Editor. So you can change the default by rearranging your tables (if you want to).

1 Like

Thanks

And to be more specific I would prefer that when the edit form comes up in the builder it shows the General tab (where the table is shown) rather than its Option tab. Every other screen/component/ form shows the General tab when they come up or are selected.

2 Likes

ah, I see. Yes, good point :+1: