I have a really strange issue happening on a SAIL form. Basically I have a two l

I have a really strange issue happening on a SAIL form. Basically I have a two local variables which contain any type arrays (X and Y). I then have a 3rd local variable (Z) where I'm trying to place either array X or array Y, based on a local boolean variable which I've set using an expression.

=load(
local!arrayX:ri!input1,
local!arrayY:ri!input2,
local!isBoolean:if(local!integerA=0,true,false),
local!arrayZ:if(local!isBoolean,local!arrayX,local!arrayY)
)

The issue is that array Z is always returning only the first index of either array X or array Y. I want it to return the whole array. I'm not really sure why this is happening. And the strangest part is that if I set local!isBoolean as true or false directly (not using an expression), then array Z returns the entire array that I want.

Anyone seen anything similar? This seems really odd. I've displayed the values of all of my arrays and boolean variable on the form so I know that th...

SAIL issue with boolean expression.doc

OriginalPostID-146293

OriginalPostID-146293

  Discussion posts and replies are publicly visible

Parents
  • Great to hear that, If we assess the code we can observe few things as follows:

    1. You are using toboolean() function and it actually returns a boolean array.
    2. fn!if() accepts a single boolean value. (If you use toboolean function even on a single value, the function turns the value into an array. ex. toboolean(true)={true})
    3. You can use a boolean array inside if() function for few scenarios. But prior to using an boolean array inside if() function, try to understand the results obtained by providing an array input, so that you can use it on need basis.

    Try executing the below snippet, the outputs will let you know why you are able to return only one row always:
    load(
    local!a:{1,2,3},
    /*
    Execute each if statement one at a time
    if({true},local!a,null),
    if({true,true},local!a,null),
    if({true,true,true},local!a,null)
    */
    )
    Hope that helps!! :)
Reply
  • Great to hear that, If we assess the code we can observe few things as follows:

    1. You are using toboolean() function and it actually returns a boolean array.
    2. fn!if() accepts a single boolean value. (If you use toboolean function even on a single value, the function turns the value into an array. ex. toboolean(true)={true})
    3. You can use a boolean array inside if() function for few scenarios. But prior to using an boolean array inside if() function, try to understand the results obtained by providing an array input, so that you can use it on need basis.

    Try executing the below snippet, the outputs will let you know why you are able to return only one row always:
    load(
    local!a:{1,2,3},
    /*
    Execute each if statement one at a time
    if({true},local!a,null),
    if({true,true},local!a,null),
    if({true,true,true},local!a,null)
    */
    )
    Hope that helps!! :)
Children
No Data