Skip to main content
September 3, 2021
Question

Validation in load and with and returning a boolean value

  • September 3, 2021
  • 3 replies
  • 0 views

Hi

I have an interface with load and with, when a user updates a value in the interface I need to return a boolean value and I am using that in another rule.

In the load I have a local variable in which I am saving the old value and in the with I an doing a isnull(symetricdifference9oldval,newVal) and assigning this to a local variable and passing this to the other rule. 

I am having an issue in setting the boolean value please advice me here. 

Thank you. 

    3 replies

    selvakumark
    Participating Frequently
    September 3, 2021

    Hi,

    From your question, I could understand that you're assigning the result to a variable in load() again, This will not work as load variables will be executed only once. If that's not the case, please share your code here(by using insert->code) for better understanding.

    Alternatively, if your Appian version supports a!localVariables(), then it'll be a lot easier to implement.

    chetankAuthor
    September 3, 2021

    Hi Selvakumar,

    I am assigning the local variable with the result in the with and using the result in the with to pass to a child interface. 

    I have a form layout in the with and I am declaring everything before the form layout. I hope the below code snippet helps to guide me. thank you.

    load(
    local!oldVal: employeeData_cdt.empName,
    
    )
    with(
    local!isReadOnly:
    if(
    and(
    isnull(symetricdifference(oldval,newVal)
    )
    )
    )
    a!formlayout(
    
    rule!EMP_Details(
    /*this is the child interface where we can edit the empl details and if the details are 
    modified I need to update the local!ReadOnly to true or false.
    )
    
    rule!EMP_Validatedetials(
    local!isReadOnly,
    )
    )
    )

    stefanhelzle0001
    Brainy
    September 3, 2021

    Appian is a functional language. This means that you need to nest your function call.

    E.g. for load(): The first "lines" are used to define local variables created in the scope of that load() call.

    Check https://docs.appian.com/suite/help/21.3/Expressions.html#local-variables

    Did you attend Appian academy?