Expression Evaluation Error Section Layout

Hi Team,

We are facing a rather weird issue with one of our SAIL Forms. This SAIL has code several sections. One of the section itself is conditional (i.e we display it using IF Conditon). Inside this section there are several components like text box, buttons etc. The button component is created using a!buttonLayout and a!buttonWidget which is again displayed conditionally.
While viewing in TEMPO, form is displayed without this section. When user keys in ,condition is satisfied and this section should be displayed. But we keep getting "Expression Evaluation Error Section Layout....". If I make the button component within this section as un-conditional ,then we get no errors. Can anybody help with this weird issue

OriginalPostID-225634

OriginalPostID-225634

  Discussion posts and replies are publicly visible

  • What is the component that is missing in your section layout that is causing the error? The button needs to be in one of the columns, either first or second. Also within the button layout, you need primaryButtons.
  • Can you attach the SAIL and the full error message? Also, do the logs give you any more information?
  • What is the rest of your error statement? I was able to replicate an error "Expression evaluation error at function a!sectionLayout [line XX]: The contents field on a column layout may only contain components. Received Number (Integer) at index 2."

    with the code below, where something that isn't a component is returned if the condition for the button condition isn't met:
    a!sectionLayout(
    label: "test",
    firstColumnContents:{
    a!textField(
    label: "Hola"
    ),
    if(0, a!buttonLayout(
    a!buttonWidget(
    label: "test"
    )
    ),1)
    }
    )

    Otherwise, can you attach your code?
  • It may sound really weird ,the IF Condition was something like this
    if(fn!tointeger(index(local!someVar,"someIndex",{}))= 2,
    a!buttonLayout(...........//CODE GOES HERE ; I changed this as below
    if(fn!tostring(index(local!someVar,"someIndex",{}))= "2",
    a!buttonLayout(...........//CODE GOES HERE ; it started working without any issues. I am not sure how it happened ,but I changed only this. (from numeric I converted to string)
  • @georgej Hi, I am not sure if you are aware of the behavior of the functions which you are making use of. In case if you aren't, please have a look at following which I am mentioning here under as per my analysis of your code and do let us know if you have any follow-up questions:
    1. fn!tointeger() returns an array if the data passed to it is in list format. Here index(local!someVar,"someIndex",{}) might be in a position to return the result in a list format which could be because of the data type of local!someVar. Go through the last point in the 'Notes' at https://forum.appian.com/suite/help/16.2/Logical_Functions.html#if.28.29 which explains you the behavior of if() when a list is passed.
    2. In case of tostring(), it returns the value in Text format (non-multiple) irrespective of the type(single or multiple) of data passed to it which you may refer from the documentation at https://forum.appian.com/suite/help/16.2/Conversion_Functions.html#tostring.28.29. And as long as the type of the data evaluated in the 'condition' of if() isn't a list, things work as expected.
    Simply speaking, tointeger() is returning an array based on the data passed to it which is causing a problem in evaluation of condition of if() whereas tostring() is able to convert the list into a singular type and isn't causing any issues.

    There could be two solutions here as per my knowledge: Either cast the value (i.e. index(local!someVar,"someIndex",{})) being evaluated in the condition so that it is of single type or cast the type of local!someVar so that it isn't in a list format.