I have several forms divided into tabs, with my SharePoint database
About the fields:
Some fields appear depending on the choices of another field, so I would like to clear the field or reset it only when the user saves and that specific condition is active.
For example:
There is a field with two choices:
Yes or No.
If the user chooses "Yes" a multiple line text field appears, and if he chooses "No" the field does not appear and will be reset or cleared when he saves (click on a button)
There is also another condition with Checkbox fields, if the user selects the specific option, clears or resets the field when he saves
I tried to use a variable to reset, but it does not clear the field, it saves the same way.
In my "SubmitButton" it has functions like "Patch", I don't know if it will influence anything.
Thanks for all the help!
Rather than resetting the field, I would change my default formula.
If (
FieldX = "Yes", PlainText(ThisItem.NameOfTheField),
""
)
What this will do is set the text input to the value of ThisItem.NameOfTheField if the first field value is 'Yes' and if the First Field value is "No", the text input will be empty.
Yes, but it resets instantly, I need it to reset just before saving, that is, when he is able to save he resets if not, no
Because of your default formula it's not going to reset the way you want it to.
Here is a workaround
On select of your item set a variable:
Set(varXXX, PlainText(ThisItem.NameOfTheField))
Set your default formula to varXXX
On save
If(FieldXXx = "No", Set(varXXXX, ""))
Thanks for the helP!
I made a variable before the patch on the save button to set the variable "true", and when I put the variable name in the field reset, it doesn't work, why?
If you are going to do it that way rather than what I recommended, then create that variable on App start and set it to false, then in your save button, you need 2 statements, Set(varReset, true); Set (varReset, false)
If I use your solution the filed instantly resets
I made this code:
If(
'BI?Radio_3'.Selected.Value = "Não";
Set(
resetItem;
true
);
If(
'BI?Radio_3'.Selected.Value = "Sim";
Set(
resetItem;
false
)
)
)
When it is "No" it resets, when it is "Yes", it does not, and the property of the field where I want to reset this with the variable: "resetItem"
But do not reset the field!
Here is the issue. It has to do with your default formula. This is why Reset is not working the way you want. Reset only resets it back to the default value. Your default value points to the value of another field. In order for reset to work the way you want, the other field has to be reset first.
Here is what you need to do. Keep your new formula and change your default formula on the text field like this:
If (
'BI?Radio_3'.Selected.Value = "Yes", PlainText(ThisItem.NameOfTheField),
'BI?Radio_3'.Selected.Value = "No" And resetItem, ""
)
Make sure you change resetItem back to false after you patch your item to your SharePoint list.
Sorry, I don't understand...
Here's my code:
If(
ObrigatoriedadeChoice_3.Selected.Value = "N/A";
Set(
resetLegislacao;
true
);;
Set(
resetPlanoDeNegocio;
true
);
Set(
resetLegislacao;
false
);;
Set(
resetPlanoDeNegocio;
false
)
);;
If(
ObrigatoriedadeChoice_3.Selected.Value = "Determinação da Alta Direção";
Set(
resetLegislacao;
true
);;
Set(
resetPlanoDeNegocio;
true
);
Set(
resetLegislacao;
false
);;
Set(
resetPlanoDeNegocio;
false
)
);;
If(
ObrigatoriedadeChoice_3.Selected.Value = "Atualização Tecnológica; Correção de problema (causa de incidente de TIC)";
Set(
resetLegislacao;
true
);;
Set(
resetPlanoDeNegocio;
true
);
Set(
resetLegislacao;
false
);;
Set(
resetPlanoDeNegocio;
false
)
);;
If(
ObrigatoriedadeChoice_3.Selected.Value = "Exigência Legal";
Set(
resetPlanoDeNegocio;
true
);
Set(
resetLegislacao;
false
)
);;
If(
ObrigatoriedadeChoice_3.Selected.Value = "Instrumento Normativo";
Set(
resetPlanoDeNegocio;
true
);
Set(
resetLegislacao;
false
)
);;
If(
ObrigatoriedadeChoice_3.Selected.Value = "Estratégico (PN)";
Set(
resetLegislacao;
true
);
Set(
resetPlanoDeNegocio;
false
)
);;
If(
varMode = "New";
If(
!IsBlank(DataCardValue10_3.Selected.Value);
If(
'BI?Radio_3'.Selected.Value = "Não";
Set(
resetItem;
true
);
Set(
resetItem;
false
)
);;
/*FormGeralNew.Valid*/
Patch(
FichaDeDemanda;
Defaults(FichaDeDemanda);
FormGeralNew.Updates;
FormJustificativa.Updates;
FormCustosEBeneficios.Updates;
FormResultadosEsperadosNew.Updates;
FormInformaçõesComplementares.Updates;
FormAnexosNew.Updates
);;
Set(
varID;
Last(FichaDeDemanda).ID
);;
Set(
varPopSalvar;
false
)/*;;SubmitForm(FormNewItemDemanda)*/;;
Notify(
"As informações da demanda foram salvas em “rascunho”";
NotificationType.Success
);;
Navigate(
Demandas;
ScreenTransition.Cover
);
Notify(
"Não foi possível salvar. A informação “Área Demandante” é de preenchimento obrigatório!";
NotificationType.Error
);;
Set(
varSalvarRascunho;
false
);;
UpdateContext({varBorder: true});;
Select(btnGeralTab_3);;
Set(
varPopSalvar;
false
)
);
If(
varMode = "Edit" && !IsBlank(DataCardValue10_3.Selected.Value);
/*FormGeralNew.Valid*/
If(
'BI?Radio_3'.Selected.Value = "Não";
Set(
resetItem;
true
);;
If(
'BI?Radio_3'.Selected.Value = "Sim";
Set(
resetItem;
false
)
)
);;
Patch(
FichaDeDemanda;
{ID: GaleriaDemanda.Selected.ID};
FormGeralNew.Updates;
FormJustificativa.Updates;
FormCustosEBeneficios.Updates;
FormResultadosEsperadosNew.Updates;
FormInformaçõesComplementares.Updates;
FormAnexosNew.Updates
);;
Set(
resetItem;
false
)
);;
Notify(
"Atualizado com sucesso!";
NotificationType.Success
);;
Set(
varPopSalvar;
false
);
Notify(
"Não foi possível salvar. A informação “Área Demandante” é de preenchimento obrigatório!";
NotificationType.Error
);;
Set(
varSalvarRascunho;
false
);;
UpdateContext({varBorder: true});;
Select(btnGeralTab_3);;
Set(
varPopSalvar;
false
)
)
/*
SubmitForm(FormSalvarElaboração);;
ResetForm(FormSalvarElaboração)*//*;;
Navigate(
Demandas;
ScreenTransition.Cover
)*/
/*
Patch(
FichaDeDemanda;
{ID: GaleriaDemanda.Selected.ID};
FormGeral.Updates;
FormPartesInteressadasViewAndEdit.Updates;
FormAlinhamentoEstratégicoViewAndEdit.Updates;
FormResultadosEsperadosViewAndEdit.Updates;
FormInformaçõesComplementaresViewAndEdit.Updates;
FormAnexosViewAndEdit.Updates
);;
Notify(
"Atualizado com sucesso!";
NotificationType.Success
);;
Navigate(
DEMANDA;
ScreenTransition.Cover
)
)*/
Where is this code?
User | Count |
---|---|
252 | |
101 | |
94 | |
47 | |
38 |