5 Most common SAIL functions that is useful for building an end-to-end application

Hi Sail Wizards out there,

I am finding it increasingly vital to be able to use functions in Appian. Apart from things the if(), index(), cast() ect...

What are some of your favourite functions and why? Ones that are less well known would be great.

A list of 3-5 would be awesome. Happy to do the learning/reading up but I first need to know about the funxtions! 

Many thanks, 

Eric

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    a!forEach() Quite possibly the single greatest individual improvement to Appian since SAIL was released

    exact() This essentially replaces the = operator, but in a way that you can use as the expression of a looping function. It also implicitly casts any datatype as a string so you can use it to compare say DateTime objects to one another or compare across types as it will be rendered when displayed. exact() is almost like JavaScript ==

    enumerate() Exceptionally useful in so many scenarios

    fixed() Absolutely vital for having large decimal values display with proper precision (large amounts of sig. figs. on either side of the decimal point)

    type! I have to mention the uncanny usefulness of the type constructor. This allows you to create test data for expression rules and SAIL forms, it's the only way you can change the value of one CDT out of an array of CDT [ ri!updateArray(arrayOfCDT, ri!myIndex, rule!ruleThat'sJustATypeConstructor(index(ri!arrayOfCDT, ri!myIndex))

    index() / property() These are technically aliases of each other, with index() being the more powerful one; no one uses property() but they should. property() returns the named property of a CDT, such as "firstName". Index returns the value at a specified point in a list, such as the 5th one, but also does the named properties. It allows for default values if it can't be found, it's less brittle than dot notation or bracket notation, and it's the only way in the world you're going to index from an indexed list (you need to get the 5th "firstName") You should expect to use index() every day
Reply
  • 0
    Certified Lead Developer
    a!forEach() Quite possibly the single greatest individual improvement to Appian since SAIL was released

    exact() This essentially replaces the = operator, but in a way that you can use as the expression of a looping function. It also implicitly casts any datatype as a string so you can use it to compare say DateTime objects to one another or compare across types as it will be rendered when displayed. exact() is almost like JavaScript ==

    enumerate() Exceptionally useful in so many scenarios

    fixed() Absolutely vital for having large decimal values display with proper precision (large amounts of sig. figs. on either side of the decimal point)

    type! I have to mention the uncanny usefulness of the type constructor. This allows you to create test data for expression rules and SAIL forms, it's the only way you can change the value of one CDT out of an array of CDT [ ri!updateArray(arrayOfCDT, ri!myIndex, rule!ruleThat'sJustATypeConstructor(index(ri!arrayOfCDT, ri!myIndex))

    index() / property() These are technically aliases of each other, with index() being the more powerful one; no one uses property() but they should. property() returns the named property of a CDT, such as "firstName". Index returns the value at a specified point in a list, such as the 5th one, but also does the named properties. It allows for default values if it can't be found, it's less brittle than dot notation or bracket notation, and it's the only way in the world you're going to index from an indexed list (you need to get the 5th "firstName") You should expect to use index() every day
Children
  • 0
    Certified Lead Developer
    in reply to Dave Lewis
    > no one uses property() but they should.

    Agreed and this bugs me a lot. For clarity of code I have set as my own personal 'best practice' to ALWAYS use property() when retrieving a dot property and index() when retrieving an array position - I also try to drill this into my new trainees and other members of my teams when it's code review time. Always using index() for both leads to nothing but confusion when you get to more complex cases i.e. trying to retrieve a particular property from a particular position in an array, etc.