my form is saving the wrong field. well .. i...

references
(David Hopkins) #1

my form is saving the wrong field.

well … it’s not saving the field that i want. Currently when I save the form it’s saving the Name element rather than the Key element. how can I specify which should be committed ?

It’s breaking my reference because the reference relies on the key of the table.

(David Hopkins) #2

@tony Hm… Im not seeing how… Let me start again…

So, I have the following tables.

Classes - key (key), Class (name) StudentToClass - key (key), Student (student key), Class (class key)

problem is that when I save the StudentToClass Form it’s writing

(key), (student key), (class name)

and this was fine for some time… I never fixed it… lol… but now that the app has grown, this is breaking other stuff.

I need it to write

(key), (student key), (class key)

going to try and regenerate … as suggested…

(Tony Fader) #3

@David_Hopkins Have you tried regenerating your column structure? It sounds like you may have changed your sheet’s columns.

https://help.appsheet.com/data/columns/when-and-how-to-regenerate-your-columns

(David Hopkins) #4

@tony The columns have not changed, but i added a reference to the table data. but that reference wont hold unless it’s populated with the Key…

rather than the name…

(Tony Fader) #5

@David_Hopkins Understood. Reference columns store the key value of the column that you’re referencing. If you want to store another column from the referenced table, you can use a formula. See this example app: appsheet.com - Row labels and keys - This app shows the difference between keys and row labels Row labels and keys - This app shows the difference between keys and row labels appsheet.com

(Tony Fader) #6

@David_Hopkins Oops, I sent the wrong app. This one is better: appsheet.com - Table References - A basic demo of table references

It shows how it pulls in the nickname from the Person table into the appointment table. Table References - A basic demo of table references appsheet.com

(David Hopkins) #7

FIXED!

In the REF table column under the Valid_if statement I changed =Classes[Class] to =Classes[key]

and magically it all works like its supposed to…

(David Hopkins) #8

@tony Thank you sir for your help…

(Praveen Seshadri (AppSheet)) #9

David, to clarify, the Ref column is supposed to hold key values of the referenced table. When you gave it a Valid_If condition that provided a list of values, none of which were actually keys in the referenced table, you ended up with strange behavior.