It appears that a!isnotnullorempty is not working the way I think it should.

I have a portal (yes a real portal) where parishes set their preferences for a speaker for Mission Co-Op Mission Sunday.

The interface has a dropdown where they select the parish they want to set preferences and sets a local variable, slectedParish.  Once the parish is selected, I load a local variable, selectedParishProfile. 

local!selectedParishProfile: if(
    a!isNotNullOrEmpty(local!selectedParish),
    rule!PMSO_getParishProfilebyParishID(local!selectedParish),
    null
  ),

Now, the parish may or may not have an existing profile. So the expression rule either returns the profile or null if one does not exist.

In the interface, I have a radio button field.  

a!radioButtonField(
    choiceLabels: { "Yes", "No" },
    choiceValues: { true, false },
    label: "Can the Parish Provide Lodging?",
    labelPosition: "ABOVE",
    value: local!selectedParishProfile[PMSO Parish Profile.fields.parishLodgingType'],
    saveInto:  local!selectedParishProfile[PMSO Parish Profile.fields.parishLodgingType'],
    required: true,
    choiceLayout: "COMPACT",
    choiceStyle: "STANDARD",
    spacing: "EVEN_MORE"
 ),

Now this throws an error when I select a parish that does not have a parish profile because the value is Null.

"A radio button component [label="Can the Parish Provide Lodging?"] has an invalid value for "value". All selected values must be present in the choiceValues array, but value was Rectory and choiceValues was true; false."

Therefore, I created a local variable parishLodging to set a default and use that in the Radio Button.

local!parishlodging: if(
    a!isNotNullOrEmpty(
    local!selectedParishProfile['recordType!PMSO Parish Profile.fields.parishLodging']
     ),
    local!selectedParishProfile['recordType!PMSO Parish Profile.fields.parishLodging'],
    false
 ),

This works until I start entering data into the selectedParishProfile record.  For some reason, the local variable parishLodging is changed from false to Null.  I don't understand why.  The a!isNotNullorEmpty function should see that the field is still Null and it should be set to false.

What am I missing here?

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data