If statement and logic

Goal: John Joe(12/2) 

Breakdown:
Name: John.Joe (User picker) 
Birthday: (date&time)

If no name is selected then present "N/A"

What I have tried: 

=if(isnull(pv!processvariable.name), "N/A", user(pv!processvariable.name,"firstName")& " " & user(pv!processVriable.name,"lastName") & "(" pv!processVariable.birthday &" )" )

Problem: Issue with If statement 

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Appian Employee
    in reply to agam

    Personally I find it more readable/codable to use the concat() function to avoid this kind of syntax error:

    = if(
      isnull(pv!processvariable.name),
      "N/A",
      fn!concat(
        user(pv!processvariable.name, "firstName"),
        " ",
        user(pv!processVriable.name, "lastName"),
        "(",
        pv!processVariable.birthday,
        " )"
      )
    )

    Separately, I notice you must be doing this in a Script Task in your process model. It's best practice to encapsulate code in an expression rule where it can be tested independently of the process itself. If you'd taken this route you would have found the error for yourself when constructing and testing the script.