Reset price column after deselecting value in enumlist

I made a if function inside the price column that says  the following. But it's not working.

Screen Shot 2022-09-29 at 7.23.48 PM.png

Solved Solved
0 20 336
1 ACCEPTED SOLUTION

Ensure the Initial value property of the [Precio de venta] column is 0 or whatever you mean be "clear".

Try something like the following in the Reset on edit column of the [Precio de venta] column.

AND([_THISROW_BEFORE].[Tipo de operacion] = "Venta", [Tipo de operacion] <> "Venta")

If necessary, you could presumably create an action that runs upon form save that clears the [Precio de venta] column value if the [Tipo de operacion] column value <> "Venta".

View solution in original post

20 REPLIES 20

How is it not working? What are you trying to accomplish?

So basically I have a price column that only shows up if a certain value is selected inside of a enumlist. If I go back and deselect that value inside of the enumlist, the price column should clear.

Use a "reset on edit" expression.

@Marc_Dillon that did work partially. I wrote the same formula in the reset on edit section and it does clear the column but I would first have to save and re-open the record, de-select the value inside of the enumlist and it works.

The way I'm expecting it to work is even before saving the record, if I deselect the value in the enumlist, it should clear the column that only shows up if that value is selected.

This is what I used inside the price column that should reset.

If(in(value,[enumlist]), true, false)

It's unclear what you mean by "Reset price column after deselecting value in enumlist".

Regardless, you may need to enclose venta in quotes if that's the explicit value or in brackets if it's the name of a column:

IN("venta", [tipo de operacion])

IN([venta], [tipo de operacion])

 

@dbaum & @Marc_Dillon  I did one before with the help of steve I belive that clears itself  depending on a yes or no question that goes:

[this column] is

Valid if:

IF(
(FALSE <> [yes_or_no_column]),
LIST(1, 2, 3..),
LIST()
)

this works even before saving the form.

-------------------------

so ultimately this price column one should clear itself out, if a certain value inside a enumlist gets deselected in the form view even before saving it.

If i select "venta" inside [tipo de operacion]

Screen Shot 2022-09-30 at 12.58.22 AM.png

 

[Precio de venta] should show up, a price column.

Screen Shot 2022-09-30 at 12.58.41 AM.png

If I then type a price:

Screen Shot 2022-09-30 at 12.58.53 AM.png

and deselect the "Venta" value from [tipo de operacion]

Screen Shot 2022-09-30 at 12.59.07 AM.png

Precio de venta should be clear.

Screen Shot 2022-09-30 at 12.59.14 AM.png

at the end, everything that shows up after selecting that value, should clear if i deselect the same value in the form view.

I"m unclear whether you need to clear the value of the price column and/or hide the price column. Maybe try your expression in each of the available properties (e.g., Show if, Valid if, Initial value, Reset on edit) to determine which behavior you're seeking.

Hey @dbaum thanks for your help. The price column does hide when I deselect the value "venta" inside the [tipo de operacion] column, that is working fine. What i'd like is for the price column to clear it's value once I deselect the "venta" value, that's all.

The column hides after deselecting "venta" from [tipo de operacion] with this formula:

Screen Shot 2022-10-01 at 3.02.40 PM.png

The column [precio de venta] does clear with the following formula, however, I'd have to save the form first and then open it again, and deselect the value "venta from  [tipo de operacion]". What I'd like is for the [precio de venta] column (the price column), to clear even before saving the form for the first time. 

 

Screen Shot 2022-10-01 at 3.02.48 PM.png

 

Ensure the Initial value property of the [Precio de venta] column is 0 or whatever you mean be "clear".

Try something like the following in the Reset on edit column of the [Precio de venta] column.

AND([_THISROW_BEFORE].[Tipo de operacion] = "Venta", [Tipo de operacion] <> "Venta")

If necessary, you could presumably create an action that runs upon form save that clears the [Precio de venta] column value if the [Tipo de operacion] column value <> "Venta".

Hi @dbaum  remember that [tipo de operacion] is a enumlist

Screen Shot 2022-10-02 at 11.26.23 PM.png

Then try adapting the expression I drafted. Use the IN function instead of = and NOT(IN(...)) instead of <>.

Like this? @dbaum 

Screen Shot 2022-10-02 at 11.38.23 PM.png

[_THISROW_BEFORE].[Tipo de operacion]

I'll give it another try. Going to work on this now. I'll let you know how it goes.

@dbaum  this is what i have now:

This is a video of how it's behaving even with this code. Remeber, I'd like for the price column to go back to $0.00 when i deselect venta from tipo de operacion from the form view.

Video of behavior

 

AND(
IN(venta,[_THISROW_BEFORE].[tipo de operacion]), 

NOT(IN(venta,[_THISROW_AFTER].[tipo de operacion]))
)

Screen Shot 2022-10-03 at 7.46.58 PM.png

 

 

You still need to tie up some loose ends in your expression. Text values typically need to be enclosed in quotes and match capitalization; also, I believe that [_THISROW_AFTER] doesn't apply until the form is saved.

AND(
IN("Venta",[_THISROW_BEFORE].[tipo de operacion]),

NOT(IN("Venta",[tipo de operacion]))
)

That said, it's possible that Reset on edit only triggers when a form is initially opened for editing--not based on edits made between opening and saving.

yea, even with this new formula in reset on edit it doesn't work as expected. I belive it should be written inside the Data Validity section, Valid if.

How do you construct this inside the IF stament?

A column's Valid if property constrains the values that can be entered and saved in the column. It does not change any existing value in a column.

I just tried the following inside valid if and it didn't work:

IF(

IN("Venta", [tipo de operacion]),

true, text(0) 

)

Running the action (process) that runs when there is adds or updates with an IF condition:

 

NOT(IN(venta,[tipo de operacion]))

 

Run: set row value [price column]= " "

This seems to clear the price column when the update finishes, it takes a while though. you can see the price still shows and then disappear.

Thanks @dbaum 

Top Labels in this Space