Hello, I need help, how can I validate that y...

(Notificaciones Notificaciones) #1

Hello, I need help, how can I validate that you do not enter a data that another user has already entered?

tks

(Levent KULAÇOĞLU) #2

@Notificaciones_Notif specifically which data or how much data you want to validate? Can you elaborate your query a bit more?

(Notificaciones Notificaciones) #3

I need to validate before a row is inserted that is no longer in google sheet. It is a very basic validation when working with concurrent users. The problem is that AppSheet only looks for the data on the device and not on google sheet.

It is the problem that I have for some time and the solution you give me does not work. You should have the option that before inserting a record validate on the table that this does not exist, not on the device locally, this does not make sense. It really is a very necessary and basic validation when working with concurrent users.

I’ve been working with you for almost 2 years and this has not been solved, and I’m sure I’m not the only one who has the same problem.

(Aleksi Alkio) #4

If the data is not in the device you don’t have any chance to cancel the process or notify the user. If the record already exists, it will overwrite it.

(Aleksi Alkio) #5

Levent’s example will help but overwiting can still happen if two users are using the app at the same.

(Notificaciones Notificaciones) #6

Exactly.

This is the answer of AppSheet: Sorry this has continued to be a problem. Since the platform allows working offline, the only way to be certain would be to block duplicates at the point of sync rather than the point of save. Ideally making the column to key would be all you need to do in that case, but the current behavior is to treat an “add” of a key that already exists as an update instead of rejecting it. In many cases it would be better to reject it. We are working on infrastructure changes that will enable more control for the app creator to decide how the platform should handle handle data conflicts and when to reject them. I think once that is done it will provide a better solution.

(Aleksi Alkio) #7

Yeap, I know :wink:

(Notificaciones Notificaciones) #8

Thanks. For the moment I have to make the app with Java. I hope this funcinality is included quickly, it really is not worth having to create something from scratch for not having such a basic validation.

(Levent KULAÇOĞLU) #9

@Notificaciones_Notif

When having concurrent users, there is no way to validate the data between those users unless the data is recorded to the sheet. You can easily validate your data as per your records in the gSheet but you cannot validate the “live/streaming” data. To the best of my knowledge, there is no any platform or software that can compare data “on-the-air”. You may also experience duplicates data if you enforce offline data content, as the data will be on the user’s device cache rather than the back-end till it pushes the record to the database.

(Notificaciones Notificaciones) #10

Effectively the validation must be done when the data is already stored in the sheet. But according to the logic of the app, if the data already exists, the information of the last user who entered it is updated, so the last user is the one who wins. I want to be able to validate that if the data is already on the sheet, I will generate an error message to the user who is entering the same data, taking into account that the last user has not synchronized and does not yet know that this data already exists.

(Aleksi Alkio) #11

Please check this older post… plus.google.com - TIP OF THE WEEK - Validation Many of you have asked how to add a validation … TIP OF THE WEEK - Validation Many of you have asked how to add a validation … plus.google.com

(Notificaciones Notificaciones) #12

The example you sent only works if the data is on the device, but if it is not there has no effect.

(Notificaciones Notificaciones) #13

It should be a workflow rule. If the record exists on the sheet, generate an error message and return.

(Levent KULAÇOĞLU) #14

@Notificaciones_Notif you can simply check if the user had not sync’d the app for a defined time limit, i.e. 5mins. and not let the user save the form

(Notificaciones Notificaciones) #15

How do I do this?

(Levent KULAÇOĞLU) #16

Construct a sheet with 1 column and 2 rows only including the header. Name the header like [LAST SYNC] and name the sheet as you like. Import this sheet to your app. Append NOW() expression to this column’s AppFormula. In your form, you can now validate the time elapsed like:

=MINUTE(NOW() - ANY(SELECT(Tablename[LAST SYNC], TRUE) - “00:00:00”) <= 5)