Check checkboxes if value is present in a database

Hi everyone,

I want to do if value is present in a database the checkbox will stay checked. If the value is not exist, the checkbox will stay unchecked.

my pseudo code will be something like this:


How to do this in CUBA. Please help me & Thanks in advanced.


  1. Use DataManager to execute query in the database: DataManager - CUBA Platform. Developer’s Manual


long count = dataManager.loadValue(
        "select count(u) from sec$User u where u.login = 'admin'", Long.class)
boolean valuefromdb = count > 0;
  1. Inject the CheckBox to the screen controller by using Studio’s actions.
  2. Assign the value via the myCheckBox.setValue(valuefromdb);

The code can be performed in the “BeforeShowEvent” event handler of the screen controller.