212
Views
13
Comments
I want change the checkbox check and uncheck based on my condition
Discussion

I want to display check box checked if the condition is Isdeleted=yes and and checkbox should be unchecked if the IsDeleted=no how to do that can anyone please help.

When i try to register freshly the check box is working fine the problem is while editing the saved data. If i click on edit if the isdeleted =no or isdeleted =yes for both the condition its displaying as unchecked.

2021-10-17 12-36-16
Amreen Shaikh

Hi Shalini,

Can you please tell in which type of app (Web, Reactive or Mobile) you are working on?

2021-10-17 12-36-16
Amreen Shaikh

If it is mobile you can check in OnAfterFetch of the aggregate.

Then assign the values to the variable.

UserImage.jpg
Shalini D M

Reactive

2024-07-05 14-16-55
Daniël Kuhlmann
Ā 
MVP

Hi,

Why do you use the values yes and no? Why didn't you make the attribute's data type a Boolean which has two possible values, True and False. 

If you bind an attribute of type Boolean to the checkbox Variable attribute, it automatically is checked if the boolean is True and unchecked if the boolean is false.

Regards,

Daniel

2023-03-03 06-59-12
Reemali patil

Hi Shalini D M,

Using a Boolean attribute directly for the checkbox is indeed a more straightforward and cleaner approach. 

Here's how you can set it up:

  • Change the data type of the "IsDeleted" attribute to Boolean.
  • Bind the checkbox widget directly to the Boolean attribute in your entity.
  • Set the default value of the Boolean attribute based on the initial state you want when creating a new
    record.
  • If you have any default values or conditions in the checkbox widget, make sure they are updated to reflect the new Boolean data type.

With this setup, the checkbox will automatically be checked if the Boolean attribute is True and unchecked if it's False. This simplifies the logic and ensures a more natural representation of the "IsDeleted" state.


Regards

Reemali.

UserImage.jpg
Shalini D M

No i can't change the data type of Isdeleted to boolean

It is mandatory to set it as yes or no (Y or N)

2024-07-05 14-16-55
Daniël Kuhlmann
Ā 
MVP

Doesn't make sense to me, a Y/N True/False value is as best practise stored as a boolean.

In that case you can in the OnAfterFetch event of the aggregate return an output parameter of data type boolean, based on the Y or N and use it to set the checkbox value.

2025-12-03 17-22-41
Lavanya Kamalaguru

Hi Shalini,

As per your request, I have added few logic. Check out my page: Checkbox 

I have attached the oml as well. Please let me know if you need any assistance.

Thanks.

Checkbox.oml
2024-05-08 06-29-37
Prince Aadil Khan Panwar

Hi @Shalini D M,

I am attaching an OML. please refer this. 

Sample - sample

Hope this will help

Thanks

Prince

checkboxcheck.oml
2022-12-30 09-46-57
Deepika Patel

Hi @Shalini D M,

Create one local variable or if you have any attribute in the entity that is bind to that checkbox after that when the condition is isdeleted =no or isdeleted =yes  just change the value of variable.

Hope this helps!

2023-12-14 09-56-57
Yogesh Javir

hello @Shalini D M ,

**If you are using aggregate then Please follow below

In aggregate add new attribute with Boolean data type and add expression in value of attribute as if(entity column value="Yes",true,false)

So  this will return true false in result of aggregate and you may bind this variable to checkbox directly.

**If you are using data action then follow below

add one attribute in your structure which are using named as IsChecked.Do looping on result of dataaction and inside loop you may add if condition like if(dataaction.list.current.isdeleted="Yes",true,false) and inside true mark your ischecked as true or false.

Hope this willl help you.

Thanks


2024-07-05 14-16-55
Daniël Kuhlmann
Ā 
MVP

Honestly, I don't understand why this discussion keeps going. 

Multiple solutions have been provided in this discussion. This whole discussion is foremost this long, as it was chosen to store a boolean value in a text attribute.

 As I mentioned in my first reply in this discussion, that is a bad decision, that not only impacts the ease on how you can set/get the value from a checkbox, but in all places in logic that requires code, like in an IF rather than checking on True or False which will automatically be validated by TrueChange you need to check by 'Y' and 'N', string literals where you can make a typing mistake that will not be indentified by TrueChange.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.