Reset on Edit not resetting to initial value

I’ve configured a field (BIN Barcode) to Reset on Edit by using a Change Time Stamp field that looks for changes in 2 specific fields (Barcode Flag and Metal BC Flag).

When there’s any change in either of the two fields, I’d like the BIN Barcode field to Reset to the fields Initial Value. It seems to work fine, until an entry is made directly into the BIN Barcode field or the calculated value is adjusted. Once this is done the field no longer Resets.

Here is the Initial Value expression:
IFS(
OR([Metal BC Flag]=Y,[Barcode Flag]=Y)," ",
AND([Barcode Flag]=“N”,NOT(ISBLANK([vir_site_id]))),
IFS(
AND([Barcode Flag]=“N”,LEN([vir_site_id])=5),“00000”&[vir_site_id],
AND([Barcode Flag]=“N”,LEN([vir_site_id])=4),“000000”&[vir_site_id],
AND([Barcode Flag]=“N”,LEN([vir_site_id])=3),“0000000”&[vir_site_id],
AND([Barcode Flag]=“N”,LEN([vir_site_id])=2),“00000000”&[vir_site_id],
AND([Barcode Flag]=“N”,LEN([vir_site_id])=1),“000000000”&[vir_site_id]
),
AND([Barcode Flag]=“N”,ISBLANK([vir_site_id])),
“5555555555”
)

Is there any way to make the BIN Barcode field Reset to blank every time the Barcode Flag and Metal BC Flag is set to Y? The use case is when a user inputs the BIN Barcode and then changes their mind and updates the Barcode Flag or Metal Barcode Flag.

image

IFS(
	OR(
		AND(
			NOT([_THISROW_BEFORE].[Metal BC Flag]=[_THISROW_AFTER].[Metal BC Flag]),
			[Metal BC Flag]=Y,
		),
		AND(
			NOT([_THISROW_BEFORE].[Barcode Flag]=[_THISROW_AFTER].[Barcode Flag]),
			[Barcode Flag]=Y
		)
	),"",
	AND([Barcode Flag]=“N”,NOT(ISBLANK([vir_site_id]))),
	IFS(
	AND([Barcode Flag]=“N”,LEN([vir_site_id])=5),“00000”&[vir_site_id],
	AND([Barcode Flag]=“N”,LEN([vir_site_id])=4),“000000”&[vir_site_id],
	AND([Barcode Flag]=“N”,LEN([vir_site_id])=3),“0000000”&[vir_site_id],
	AND([Barcode Flag]=“N”,LEN([vir_site_id])=2),“00000000”&[vir_site_id],
	AND([Barcode Flag]=“N”,LEN([vir_site_id])=1),“000000000”&[vir_site_id]
	),
	AND([Barcode Flag]=“N”,ISBLANK([vir_site_id])),
	“5555555555”
)

Thanks Levent, I inserted the expression and received the error below:

@Daisy_Ramirez
Can you try with this one pls?

IFS(
	OR(
		AND(
			NOT([_THISROW_BEFORE].[Metal BC Flag]=[_THISROW_AFTER].[Metal BC Flag]),
			[_THISROW_AFTER].[Metal BC Flag]=TRUE,
		),
		AND(
			NOT([_THISROW_BEFORE].[Barcode Flag]=[_THISROW_AFTER].[Barcode Flag]),
			[_THISROW_AFTER].[Barcode Flag]=TRUE
		)
	),CONCATENATE(""),
	AND([Barcode Flag]=FALSE,NOT(ISBLANK([vir_site_id]))),
	IFS(
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=5),"00000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=4),"000000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=3),"0000000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=2),"00000000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=1),"000000000"&[vir_site_id]
	),
	AND([Barcode Flag]=FALSE,ISBLANK([vir_site_id])),
	"5555555555"
)

Same error:

@Daisy_Ramirez
That’s my bad forgetting about a redundant comma inside the first AND expression of OR envelope, sorry. Try with this:

IFS(
	OR(
		AND(
			NOT([_THISROW_BEFORE].[Metal BC Flag]=[_THISROW_AFTER].[Metal BC Flag]),
			[_THISROW_AFTER].[Metal BC Flag]=TRUE
		),
		AND(
			NOT([_THISROW_BEFORE].[Barcode Flag]=[_THISROW_AFTER].[Barcode Flag]),
			[_THISROW_AFTER].[Barcode Flag]=TRUE
		)
	),CONCATENATE(""),
	AND([Barcode Flag]=FALSE,NOT(ISBLANK([vir_site_id]))),
	IFS(
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=5),"00000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=4),"000000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=3),"0000000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=2),"00000000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=1),"000000000"&[vir_site_id]
	),
	AND([Barcode Flag]=FALSE,ISBLANK([vir_site_id])),
	"5555555555"
)
1 Like

Hi Levent, no error this time but the field still stays the same after an input is made into field. In this case I adjusted the field, pressed “Y” to “Is there a Metal Barcode to scan?” field. Once I press 'Y" here or in the “Is Barcode Available?” field, it should revert to a blank field.

The Change Time Stamp is changing so I can see it recognizes the change was made.

May I ask what’s you Reset_On_Edit expression for that [BIN Barcode] column?

[_THISROW_BEFORE].[ChangeStamp_BINBC]<> [_THISROW_AFTER].[ChangeStamp_BINBC]

Which column(s) that [ChangeStamp_BINBC] checks for the ChangeTimestamp?

Change your Reset_On_Edit expression with this:

OR(
	AND(
		NOT([_THISROW_BEFORE].[Metal BC Flag]=[_THISROW_AFTER].[Metal BC Flag]),
		[_THISROW_AFTER].[Metal BC Flag]=TRUE
	),
	AND(
		NOT([_THISROW_BEFORE].[Barcode Flag]=[_THISROW_AFTER].[Barcode Flag]),
		[_THISROW_AFTER].[Barcode Flag]=TRUE
	)
)

And you can use this as the Initial Value

IFS(
	OR(
		[Metal BC Flag]=TRUE,
		[Barcode Flag]=TRUE
	),CONCATENATE(""),
	AND([Barcode Flag]=FALSE,NOT(ISBLANK([vir_site_id]))),
	IFS(
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=5),"00000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=4),"000000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=3),"0000000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=2),"00000000"&[vir_site_id],
		AND([Barcode Flag]=FALSE,LEN([vir_site_id])=1),"000000000"&[vir_site_id]
	),
	AND([Barcode Flag]=FALSE,ISBLANK([vir_site_id])),
	"5555555555"
)

Ok updated the Reset on Edit and Initial Value fields and no luck. Once the BIN Barcode field is edited, it does not respond to the Reset on Edit.

@Steve? @Aleksi?

2 Likes

Thanks so much for your help Levent. I’ll keep an eye out for Steve or Aleksi.

Thanks again.

1 Like

Any column with an Initial value expression will only be automatically until the user manually changes the column’s value.

image

Is this the behavior you’re seeing?

Reset on Edit kinda stuffs, i would share my recent experiences.

When we refer to other column on other fields being change, we normally do that with expression

[_thisrow_before].[Col1]<>[_thisrow_after].[Col1]

to fire to reset the value to the initial value.

But due to the bug, it wont work for the moment.

This syntax only work on this occassion.

[_thisrow_before].[Col1]<>[Col1]

This is a bug, and I reckon DEV team should have been working on, but not hearing this is solved.

1 Like

@Steve
She wants to reset the value of a column to its initial value provided any one of the 2 watch-up column value is edited/altered. That’s the query basically.

1 Like

Yes, this is correct.

Steve your description is exactly what I’m experiencing. The initial value resets as expected with my and Levent’s expressions but once the user overrides the BIN Barcode field, the reset no longer executes even though the record has not yet been saved etc.

@tsuji_koichi
@Daisy_Ramirez
Then I would recommend using a LOOKUP expression instead of [_THISROW_BEFORE] and [_THISROW_AFTER]

[Metal BC Flag] <> LOOKUP([_THISROW],"Tablename","KeyColumnName","Metal BC Flag")