Undocumented Appian Functions: A Deep Dive

AKA UnOfficialDocuments Not Supported By Appian

Gems Are Someone or Something Rare to Find and to Be Used on One’s Own Responsibility.

The same Goes Here With Appian.

Let’s Deep Dive and See Some of Them.

1)Try

                Try In Appian 
/*
Sample Java Code to Hadle Exception
try {
    Block of code to try
}
catch(Exception e) {
    Block of code to handle errors
}
*/
/*
Similarly we do have in Appian Which is Undocumented FunctionsCategory
try( [TRY CODE] , [CATCH CODE] )
The try() function can allow you to get some error handling within Appian, although it will not work to catch all error types.
Usage examples:
Sample Test Cases
TC 1*/
try(1=a, "Failed")
/*will return "Failed".*/
/*TC 2*/
try(concat("a", "b"), "Failed")
/*will return "ab".*/
/*The try() function will not catch every type of expression error. For example:*/
try('asdf', "Failed") 

2) fn!lasterror()

/*fn!lastError()*/
/*You can query the error from try() using fn!lastError().*/
/*For example:*/
try(

  1.101+a,
  fn!lastError().details

)

/*Will return
"Expression evaluation error at sum  [line 4]: 
Too few parameters for function;
expected coorrect Parameters."
*/

3) EVAL()

Evaluates text as JavaScript code using the eval function, allowing for dynamic execution of code based on text input.

The use of eval() enables dynamic code execution based on runtime values, which can be useful in situations where the code structure needs to be flexible and determined at runtime. However, it’s important to note that using this function can pose security risks similar to SQL injection, as it allows potentially malicious code to be injected and executed.

eval("a!forEach(enumerate(1000)+1,if(rule!LA_ArmStrongNumber(fv!item),fv!item,{}))")
or
a!forEach(enumerate(1000)+1,if(rule!LA_ArmStrongNumber(fv!item),fv!item,{}))
Resultans of Both Code will Be Same 😊😊(Bueaty Of Appian ) 

4) Sort()

Sorts an array in ascending or descending order.

a!localVariables(
  local!value: a!forEach(enumerate(20), char(65 + fv!item)),
  {
    asc:sort(local!value),
    dsc:reverse(sort(local!value))
    }
)

Native Appian Implementaion which Supported in Appian

a!localVariables(
  local!value: a!forEach(enumerate(20), char(65 + fv!item)),
  local!asc: true(),
  if(
    a!isNullOrEmpty(local!value),
    {},
    reject(
      fn!isnull(_),
      a!flatten(
        todatasubset(
          a!forEach(
            items: local!value,
            expression: { value: fv!item }
          ),
          a!pagingInfo(
            1,
            - 1,
            a!sortInfo(
              field: "value",
              ascending: toboolean(local!asc)
            )
          )
        ).data.value
      )
    )
  )
)

4) lambda_appian_internal()

An lambda function is a function defined on the fly, usually at the point where it’s needed.

Lets Create out Favourite Code Find Even Numbers using lambda_appian_internal Function.

a!localVariables(
  local!nums: enumerate(20) + 1,
  local!dummyCall,
  local!check: lambda_appian_internal(
    ri!dummyRI,
    if(mod(ri!dummyRI, 2) = 0, ri!dummyRI, {})
    
  ),
  a!forEach(local!nums, local!check(fv!item))
)

5) Copy To ClipBoard

a!localVariables(
  local!copyText: proper("Hey Its A hi from your Lead Developer"),
  local!link: 'type!{http://www.appian.com/ae/types/2009}CopyToClipboardLink'(textToCopy: local!copyText),
  {
    a!richTextDisplayField(labelPosition: "COLLAPSED",value: {a!richTextIcon(icon: "copy",linkStyle: "STANDALONE",
    link: local!link),char(32),a!richTextItem(text: "COPY-TEST",linkStyle: "STANDALONE",link: local!link)})
  }
)

For more Such Have a look at Our Other Contents .

Let’s Meet in Some other Post.


Discover more from Appian Tips

Subscribe to get the latest posts sent to your email.

Leave a Reply

Up ↑

Discover more from Appian Tips

Subscribe now to keep reading and get access to the full archive.

Continue reading

Discover more from Appian Tips

Subscribe now to keep reading and get access to the full archive.

Continue reading