Skip to main content
michaelk1933
New Participant
Jun 27, 2023 2:55 PM UTC
Question

Use of { & } to delimit functions in an object

I'm in a discussion with a colleague on whether its legal to use {} to delimit nested variables in an if statement.

I.e.:

if(
{                 this

and(or(
isnull(local!shortRecon.recordsRequested),
isnull(local!shortRecon.reconsiderationRequested)
),
local!claim.claimStatusId<>cons!OWB_DBID_LOOKUP_ID_CLAIM_STATUS_FINAL_ORDER_ISSUED
)
},                 and this


{                 this

if(isnull(local!shortRecon.recordsRequested),a!save(ri!recon.recordsRequested,false),{}),
if(isnull(local!shortRecon.reconsiderationRequested),a!save(ri!recon.reconsiderationRequested,false),{})

},                 and this
{}
)

Is this acceptable use?

    4 replies

    stefanhelzle0001
    Brainy
    Jun 27, 2023 2:58 PM UTC

    As curly brackets indicate a list in Appian, I would not do that. There are some ugly edge cases, almost impossible to debug.

    mikes0011
    Brainy
    Jun 27, 2023 3:02 PM UTC

    I'm not even sure what you mean by "nested variables" in the context of the code sample you've posted here.  Any chance you could post a cleaner example, with indentation, and in a Code Box where it'll maintain some amount of readability?  If any of the wording ("and this" etc) is meant as annotative, then put it in /* comment blocks */ for clarity.

    I will say, up front, that you can nest and() and or() conditional logic to almost any level (limited only by a viewer's ability to make sense of whatever spaghetti code we end up creating), which never requires "{}" - since as Stefan correctly noted, these specifically incidate arrays to Appian.

    The Expression Guru
    michaelk1933
    New Participant
    Jun 27, 2023 3:02 PM UTC

    Mea culpa !

    mikes0011
    Brainy
    Jun 27, 2023 3:04 PM UTC
    Mea culpa !

    No need for apologies [emoticon:c4563cd7d5574777a71c318021cbbcc8]  We merely want to coax out of you what you're actually intending to do, hopefully to provide clarification as far as creating Appian code that's more graceful and/or efficient.

    The Expression Guru