Weird save behavior {"Apple","Banana"} to null

Certified Senior Developer

Hi.

I was setting up some save functionality for the one spot in my code that saves to a particular variable.

I had a rule that outputs null under certain conditions, but kept watching it show up as {null} instead.

I have tried to simplify the issue and have found saving into the localvariable something like {"Apple", "Banana"} results in straight null instead. 

What is happening in my interface?

If i save the same value to a random debug variable it works fine.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer
    in reply to Mathieu Drouin

    Ok so the real issue seems to be the act of assigning this code to a variable as the page loads, permanently taints the variable, and it cant be saved into normally.


    local!projectMouSubStatuses:if(a!isNullOrEmpty(local!projectMOU.statusId),
                                      null, 
                                      a!forEach(
                                        local!projectMouStatuses, 
                                        if((fv!item.description)=(local!projectMouStatuses[local!projectMOU.statusId].description), 
                                        fv!item.subStatus, 
                                        {}
                                      ))),

  • You can certainly save into a variable that is defaulted on form load, the exception is refresh variables with these settings cannot be saved into:

    refreshAlways (Boolean): When true, the value of this local variable will be refreshed after each user interaction and each interval refresh. Because the variable is continually refreshed, you cannot update its value by saving into it. Default: false.

    refreshInterval (Number (Decimal)): How often the variable value gets refreshed in minutes. When null, the variable will not be refreshed on an interval. Because the variable is periodically refreshed, you cannot update its value by saving into it. You can access the current value of the variable using fv!value (see the documentation for an example). Valid values: 0.5, 1, 2, 3, 4, 5, 10, 30, 60.

    Ex:

    a!localVariables(
      local!counter: 0,
      
      a!sideBySideLayout(
        items: {
          a!sideBySideItem(
            width: "MINIMIZE",
            item: a!buttonArrayLayout(
              align: "START",
              buttons: {
                a!buttonWidget(
                  label: "Increment",
                  value: 1+local!counter,
                  saveInto: local!counter
                )
              }
            )
          ),
          a!sideBySideItem(
            item: a!textField(
              label: "Count",
              value: local!counter,
              readOnly: true
            )
          )
        }
      )
    )

Reply
  • You can certainly save into a variable that is defaulted on form load, the exception is refresh variables with these settings cannot be saved into:

    refreshAlways (Boolean): When true, the value of this local variable will be refreshed after each user interaction and each interval refresh. Because the variable is continually refreshed, you cannot update its value by saving into it. Default: false.

    refreshInterval (Number (Decimal)): How often the variable value gets refreshed in minutes. When null, the variable will not be refreshed on an interval. Because the variable is periodically refreshed, you cannot update its value by saving into it. You can access the current value of the variable using fv!value (see the documentation for an example). Valid values: 0.5, 1, 2, 3, 4, 5, 10, 30, 60.

    Ex:

    a!localVariables(
      local!counter: 0,
      
      a!sideBySideLayout(
        items: {
          a!sideBySideItem(
            width: "MINIMIZE",
            item: a!buttonArrayLayout(
              align: "START",
              buttons: {
                a!buttonWidget(
                  label: "Increment",
                  value: 1+local!counter,
                  saveInto: local!counter
                )
              }
            )
          ),
          a!sideBySideItem(
            item: a!textField(
              label: "Count",
              value: local!counter,
              readOnly: true
            )
          )
        }
      )
    )

Children
No Data