Reset on Edit with Expression not resetting to initial value

I have Reset on Edit selected for a field [TRUCK NUMBER] and the initial value is blank. I’m using the following expression to trigger the reset but it doesn’t seem to trigger the change. When I change the Division field, the Vehicle Number field maintains the original entry. Is the Reset on Edit not intended to work with an expression like this?

[_THISROW_BEFORE].[Division]<> [_THISROW_AFTER].[Division]

You must always check for a blank left-side value if a blank value is possible. = and <> do not properly compare a blank left-side value.

See also:
https://community.appsheet.com/search?q=@steve%20quirk

3 Likes

Thanks Steve, I read through info regarding the ISBLANK and ISNOT BLANK from the link you provided and tried the following expression with no luck. I’m hoping to not have to create a new ChangeTime Stamp field to minimize changes to the tables.

AND(ISNOTBLANK([Division]),[_THISROW_BEFORE].[Division]<> [_THISROW_AFTER].[Division])

OR(ISBLANK([Division]),[_THISROW_BEFORE].[Division]<> [_THISROW_AFTER].[Division])

What about one of these?

AND(ISNOTBLANK([_THISROW_BEFORE].[Division]), [_THISROW_BEFORE].[Division] <> [_THISROW_AFTER].[Division])
OR(ISBLANK([_THISROW_BEFORE].[Division]), [_THISROW_BEFORE].[Division] <> [_THISROW_AFTER].[Division])
3 Likes

Hi, @Daisy_Ramirez @Steve

Let me make one suggestion.
How about the following expression?

[_THISROW_BEFORE]. [Division]<>[Division]

1 Like

No luck Steve and Takuya. I’m expecting the Vehicle Number field to clear (reset to the fields Initial Value) when the Division is changed. Maybe I’m not thinking about this the right way. Both expressions seem correct but don’t seem to trigger the reset.

image

@Daisy_Ramirez

It might be a good idea to try a simple test field once.

Is this the correct behavior?

My Division field

My TruckNo field

4 Likes

We need to remove [_thisrow_after]. operator in case we use the syntax in the place of reset-on-edit to work.
Appsheet dev team has been aware of since I reported this as bug initially, but yet a fix is released.

4 Likes

Yes, this is the exact behavior I’m seeking. The selection of Osaka cleared the Truck No field. The key difference I can see is the Division field is a REF field and Truck No is a dependent REF field and displays options based on the selected Division field. See Expression below:

SELECT(
Vehicles[vehicle_rec_id],
OR(AND([Division]=[_THISROW].[Division],[Type]=[_THISROW].[Receive From],[Status]=Active),[vehicle_rec_id]=“OTHER”)
)

I don’t see why there would be difference but wanted to provide the variance in two configs. Do you believe this variance would impact the reset capability?

Hi @Daisy_Ramirez

In which setting is this Expression written in the TruckNo field?

Since I don’t have the schema information, I can’t give you a definitive answer, but I recommend that you extend the Expression a little bit and verify it.

For example, change the Division and TruckNo to a simple Ref type and check the behavior of Reset on Edit.
After that, if you add conditional expressions little by little, you will be able to identify the breaking point.

Here is the complete schema



Please explain in plain English, and with no AppSheet or database terms, how you want the truck number value to behave.

Takuya’s video is the exact behavior I’m needing.

User selects a Division
User selects a Vehicle Number (Truck Number) that corresponds to the Division
User changes his mind and selects a different Division
The Vehicle Number field clears
User selects the Vehicle number that corresponds to the new Division

Reset on edit? doesn’t come into play here. Reset on edit? is only considered when the form is first opened; once opened, Reset on edit? has no further effect.

I don’t believe there’s a way to do what you want.

1 Like

Hi Steve, so if I understand this correctly Reset on Edit would only work when the data has been previously saved and you’re editing an existing record not “editing” an initial entry form.

Is there anything else I can use to clear out that field when the Division field is changed to prevent the user from leaving the incorrect Truck Number (one not associated with the newly selected Division)?

When the row is initially created, Initial value is always applied. On subsequent edits of the row, Reset on edit? is consulted to determine whether the Initial value expression should be applied again.

There are several possible approaches:

  1. Use a Valid If expression that fails if the chosen truck number isn’t valid, thereby preventing the user from saving the form until corrected.

  2. Use a Form Saved event action to clear the chosen value if it’s not valid.

  3. Use a workflow to clear the chosen value if it’s not valid.

2 Likes

Thanks Steve as always for the help, I will advise the client.

3 Likes