Form - new row references ID instead of name

I’m sure this topic has been covered dozens of times but I must be slow…

My app is trying to log instances of contacts with customers. The form references the list of clients to select from. If it is a new client the user selects “New” and is taken to the Client Form. Once the user inputs the Client info and saves they are taken back to the Contact Form but the Client ID is populated in the Client Name Field. What am I doing wrong.

Note: The Contact Table has references in both columns for Client ID and Client Name.

Thoughts?

Why double ref columns? Do they ref to the same table?

No need I guess. Should I just reference the Client ID? I would like to allow the user to select from a list of Client Names in the form.

Ignore me! I’m an idiot! And to prevent anyone else from making the same mistake, I’ll post my embarrassing solution here…

In my client list I have 3 columns in the table… Name, First, Last. In the Form I’m asking the user to input First and Last. So when they submit the form the First and Last come over but the Name column is empty. So when the user is taken back to the Contact Form there is no value in the Client Name column to insert, so it defaults to the Client ID.

My fix… put a formula in my Name column on my Client Table: [First]&" "&[Last].

It must be Friday!..looky there…it is Friday! :slight_smile:

Hang on…this still isn’t working as expected. The Client Name comes over into the Client Name field in the Contact Form but once submitted, I’m getting the Client ID in the Client Name field in my data.

What am I missing?

When you use a REF column, the dropdown list always displays the LABEL column value of the referenced table. However, when the record is saved, it records the KEY COLUMN VALUE of the referenced row. In general, provided you have a First Name and Last Name columns, AppSheet automatically created a Virtual Column of [_ComputedName] and assigns it as a Label column. So with a REF to this table, the dropdown displays the values from this Virtual Column.

I may advise removing that Name column from the Client table initially. Following regenerating the column structure, provided AppSheet does not create this afore-mentioned virtual column, create it manually, give any column header as you like with a simple expression of [First]&" "&[Last] and assign it as the Label column for the Client table.

1 Like

Levent,

Thank you! After agonizing and stepping through this process one mini-step at a time, I learned a big lesson about REF. I finally realized that you can “fool” the user into thinking they are choosing from a list of names vs a list of IDs by changing the Label. Also, by changing the Display Name to “Client Name” the user doesn’t realize they are actually selecting the ID.

I finally understand the concept!!! Yes…I’m slow! Now if I can just retain this lesson.

Thanks for sticking in there with me!

3 Likes

You’re very welcome.