Records didnt save to database incase of using ref column

Hello All,

I am facing a problem with appsheet

i have a workorder form contain :

workorder id ( number as a key ) , sample no( ref from Sample table ), sample name ( text with initial value from sample table / name )

I am using this to autocomplete sample name :

any(Select(Sample[File],[_thisrow].[Sample Ref]=[Sample No]))

its autocomplete, but after i add and save the workorder form , record appears for some seconds and disappear.. and never store in database .

when i cancel the sample no ( ref ) . Its works

Also when i keep sampe no ( ref) empty its store and works.

——-

What i need is :

create a form ( workorder ) with auto complete data ( reference from Sample table ) and store it as an order with this sample data ..

i wish you can help with disappearing records problem..

First, you do not need to use this expression to populate the “sample name” column. Since your Sample No column is a Ref, you can simply dereference the “sample name” for it.

Use this expression in your sample name column:

[Sample No].[File]

As to the disappearing record, you mention leaving the Sample No column blank the row saves properly. How are you populating the Sample No column?

Can you show a screenshot of the Sample No column definition?

Can you get a screen sho of your WorkOrder table in AppSheet showing all of the columns?

1 Like

thanks for your replay

1 Like

PLEASE HELP

You are using the Sample No as the row key and assigning it with an Initial Value expression of :

MAX(Sample APP[Sample No])+1

This will not work. If two users were doing this action at the same time, they could both get the same row key value. This creates a conflict for the row key and only 1 row will ever be shown in the app.

I get that you want a sequential number in the Sample No column but in a multi-user distributed system like AppSheet, it is basically impossible to do that - for the same reason mentioned about row key above. However, with certain care and circumstances it may work for you. Please read this post for more details.

I see you have a Row ID column in the table. I recommend using that column as your row key. Set the Initial Value to “UNIQUEID()” and I beleive you will see your disappearing row problem go away.

However, you will likely see occasionally that the Sample No column gets a duplicate value when multiple users are adding rows at nearly the same time.

1 Like