Index() or dot notation?

Certified Lead Developer

Hi All,

I just wanted to know what's Appian best practices when it comes to retrieving data from a data subset. Should I index into the data subset or use dot notation? I noticed that when I use index() it doesn't throw an error for a null result set but does throws an error if I use dot notation. I know dot notation would cause a pink screen error on the tempo interface but debugging this would be quite simple since we know exactly where the error is coming from. For index(), this wont throw an error on tempo but will be harder to debug and would be a silent fail if a user doesn't raise the issue that that data is coming null when it shouldn't. 

  Discussion posts and replies are publicly visible

Parents
  • Certified Lead Developer
    I personally prefer to use property() to retrieve dot properties, and reserve index() for retrieving indexes (i.e. from an array) -- even though the two functions are functionally identical, i stress that it can help for comprehension, review, and troubleshooting purposes to have their uses segregated such.

    For instance, think of a time when you want to get a certain property from a certain index in an array... multiple-nested index() functions can get pretty hard to read pretty quickly.
Reply
  • Certified Lead Developer
    I personally prefer to use property() to retrieve dot properties, and reserve index() for retrieving indexes (i.e. from an array) -- even though the two functions are functionally identical, i stress that it can help for comprehension, review, and troubleshooting purposes to have their uses segregated such.

    For instance, think of a time when you want to get a certain property from a certain index in an array... multiple-nested index() functions can get pretty hard to read pretty quickly.
Children