Check if a value was selected in mutiselect field

How can i check if a multiselect field is empty and how to check number of selected values

 if (is_null($Lead->lob_c)) {

tried this but even choosing a value is considered null

Have you tried looking in the database to see how the value is stored there?

Or another approach would be to find a multi-select field in the core code and checking how it is handled there.

in database all values are null is there a solution to this

are you connected to the correct database? If you see a value in the frontend, but the value is not visible on the db-level, something is definitely wrong (wrong db? wrong table/field?).

Multi select fields are stored with something like ^key1^key3^ if key1 and key3 are selected (this is the key and not the label)
You can use unencodeMultienum($bean->field) to transform the stored value into an array.

1 Like