How to clear checkbox type variable if All is selected

abhaysingh98
Tera Contributor

Hi Guys,

 

I am having an issue I have created few variables with variable type as checkbox(attached screenshot for field deatils) I have multiple field as checkbox type also have a variable name as All it is also checkbox type, so the requirement is when I select All variable then other variable should be unticked and only All varible will be selected and if other variable is selected then All should be unticked.

 

I have created the UI Policy to clear the value of other variable when All is selected but it is not working when other variable is selected then All is also selected but I don't want All to be selected incase any other variable is selected.

4 REPLIES 4

SHALIKAS
Tera Guru

Hii,
In the UI Policy, please check Applies on Requested Items on UI policy form.

SHALIKAS_0-1724930089688.png

 

If still not working try below.

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading) {
        return;
    }
    if (newValue != '') { //you can give value and clear based on the value
        g_form.clearValue('variablename'); //add your variable that need to clear 
    }
}

Ehab Pilloor
Mega Sage

Hi @abhaysingh98,

I am not able to view your screenshots due to restrictions but if you haven't used All variable in UI Policy Action, then add UI Policy Action for All and set the opposite value of the other variable to it and try it.

 

If you found my response helpful, please mark it as Solution and Helpful.

 

Thanks and Regards,

Ehab

Anubhav24
Mega Sage

Can you paste the screenshot of the ui policy you have written when value is not all and other variable value is selected.

@abhaysingh98 

I think writing the UI Policy only for all should work when value of variable is ALL clear other variable values and under false condition i.e. when value is not all you can clear the ALL checkbox and set it to unchecked.

Please mark helpful/correct if my response helped you.

Rohit99
Mega Sage

Hi @abhaysingh98,

when you are clearing value at the same time you need to make value readonly for other checkboxes.

You may try with the following configuration :

Rohit99_0-1724936263488.png

 

 

Rohit99_1-1724936456738.png

 

 

Rohit99_2-1724936960451.png

 

 

 

Please mark my response as correct and helpful if it helped solved your question.

 

Thanks,

Rohit Suryawanshi