Block the user from editing fileds before the sync is completed

Hi, is there a way can block the user from editing fileds into a detail view with quick edit columns before the sync complete?

The reason is that we need to do a sequential numbering for that table and the best way we found was to let Appsheet servers attribute the number instead of making an inital value. We use that on other apps and it works great, it minimize the risk of having same numbers because another app was not up to date..

So, our users will create an order, once saved they see the detail view that has quick edit columns (we want to keep). If they edit those columns before the save/sync is completed, it will erase the sequential number that Appsheet server as already given to the order.

Let me know if someone has an idea of how we can handle this?

Thank you,

Untested, but you could try this:

  1. Add a virtual column named (e.g.) sync_when with an App formula expression of NOW(). The value will be updated any time any normal (not virtual) column value of the row changes, and whenever a sync occurs (this is the important part).

  2. Add a normal (not virtual) column named (e.g.) edit_when of type ChangeTimestamp that responds to the columns you care about. If it’s pretty much all of the columns, you could just use a column type of DateTime and an App formula of just NOW(). Its value would be updated every time a normal (not virtual) column of the row is changed.

  3. Set the Edit? expression for the columns you care about to ([sync_when] > [edit_when]).

You could try to implement (2) with a virtual column instead using an App formula like this:

IFS(
  OR(
    (("x" & [column1]) <> ("x" & [_THISROW_BEFORE].[column1])),
    (("x" & [column2]) <> ("x" & [_THISROW_BEFORE].[column2])),
    ...,
    (("x" & [columnN]) <> ("x" & [_THISROW_BEFORE].[columnN]))
  ),
    NOW()
)

Replace column1, column2, …, columnN with the names of the columns you care about.

1 Like

Ooh… sounds good. I’ll try that!

Thanks for your quick reply!

2 Likes

Hi Steve!

That also block me when adding the row. It is the same fields we want to prevent editing than the one we need to fill when adding the row.

1 Like

Simply need to add

OR(CONTEXT(view)="FORMVIEWNAME", [sync_when] > [edit_when])

Thank you for your help!

2 Likes

How I would do it:

OR(
  ([sync_when] > [edit_when]),
  NOT(IN([_ROWNUMBER], table[_ROWNUMBER])
)
1 Like