If condition with another condition inside the result part.

Certified Associate Developer

Hello, 

I am thinking how I can achieve something like this with seal only, 

a!localVariables(
local!data:
if(
isnull(local!a1),

updatedictionary(),
/* Second Condition */
if(isnull(local!b1),
),

),
null
),
local!data
)

basically if condition for null value, if it is null exit, if it is not null do action and that check next value, problem is that in the if there are condition, true(), false()) where it does not allows a action with another if inside the result part. 

Any idea which is the best approach ?

  Discussion posts and replies are publicly visible

Parents
  • Hi Vladimir, you should be able to achieve this but the solution will depend on where you are performing this and what it is doing.  Is this used for a!save() when a button is depressed or a field is changed, or what are we doing here exactly, etc?

    Some quick examples with saving data on button press, Submit 1 cascades the if() statements and Submit 2 separates them out independantly.

    a!localVariables(
      local!data1: null,
      local!data2: "test",
      local!value1,
      local!value2,
      
      a!buttonLayout(
        primaryButtons: {
          a!buttonWidget(
            label: "Submit 1",
            submit: true,
            saveInto: {
              if(
                isnull(local!data1),
                {}, /* do nothing */
                if(
                  isnull(local!data2),
                  {}, /* do nothing */
                  a!save(local!value2,"test")
                )
              )
            }
          ),
          a!buttonWidget(
            label: "Submit 2",
            submit: true,
            saveInto: {
              if(
                isnull(local!data1),
                {}, /* do nothing */
                a!save(local!value1,"test")
              ),
              if(
                isnull(local!data2),
                {}, /* do nothing */
                a!save(local!value2,"test")
              )
            }
          )
        }
      )
    )

  • 0
    Certified Associate Developer
    in reply to Chris

    well it is actually not related to button press, it is one expression which is given certain data and have to check it all. lines of data, if the next line does not contains data stop iterations are this point. 

Reply Children
No Data