Erase Values on enum change

Hi,

I need some help with an Enum column in my app.

The user chooses a payment method consisting in 3 options in an Enum column called [Meio de Pagamento]. These options are:

  • Débito
  • Transferência entre contas
  • Chave Pix

Some columns appear based on the option chosen.

If the enum is changed again after user input (but not saved) I want the columns, that are not for the method chosen, to be reset to blank OR when the form is saved, these columns return to blank value since they are not for the chosen enum value.

==========================================

I'll show it more clearly:

checktheclaws_2-1678808115860.png   checktheclaws_1-1678808077464.png

Above, the value of [Meio de Pagamento] Is blank. Below, when I choose a value from the enum, some columns appear based on the option chosen.

checktheclaws_3-1678808238978.pngchecktheclaws_4-1678808346574.png

Above - User write some data on the fields. Below - User changes its mind and change the enum value on [Meio de Pagamento] column.

The problem is when the user saves the form, the data that was written in the columns proper to "Chave Pix" option (that was chosen before), they are saved too in the Database.

checktheclaws_5-1678808650421.png

I want the fields that are not for that particular method to be erased.

Ideally would be better to be erased while in the form when the user changes the enum value.

Is that possible?

0 5 174
5 REPLIES 5

First, try this for columns like the Clave Pix

  1. Put an initial value as "".
  2. Put the conditions where this field can be edited in the Editable If  column field. 

Hi @Joseph_Seddik

Thanks for the reply. 

It didn't work.

If the user input something then change the method of payment, it gets uneditable, but the data that was written in the field is saved.
I guess the only way to do this is a bot that erase the values of the columns unused after the form is saved... I didn't want it this way, but I think it's probably the only way.

Any other ideas?

I'd just ignore this field in the app logic. Also I'd use a virtual column for display having a formula that reads or ignores the field upon certain conditions.

That's another way to do it.
I still think that a bot would be more clean.

Any idea if a bot would be a bad idea in this situation?
I mean, can a bot fail to update the data? Have you seen this happen ever?

Thanks for the feedbacks Joseph, real appreciated.

A bot should work just fine !

Top Labels in this Space