Index vs property

Certified Associate Developer

what is the main difference and what to use where

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Both are same , it clearly mentioned in Documentation that Property is alias of index

    Normal difference is ,We go for Property function when we try to get the value of a property/Field in CDT or dictionary like property(CDT,"field",default value) it can be achieved through index too

    And we use index to get the value from array like index(Array,3,null)

  • Normal difference is ,We go for Property function when we try to get the value of a property/Field in CDT or dictionary like property(CDT,"field",default value) it can be achieved through index too

    And we use index to get the value from array like index(Array,3,null)

    Thank you, this is my normal soap box too.

    For code readability especially, i (100% of the time) recommend property() be used for getting a "field" from a CDT, and index() be used for getting the index i.e. position within an array, when it's not 100% clear whether the array will have an entry at that index.

Reply
  • Normal difference is ,We go for Property function when we try to get the value of a property/Field in CDT or dictionary like property(CDT,"field",default value) it can be achieved through index too

    And we use index to get the value from array like index(Array,3,null)

    Thank you, this is my normal soap box too.

    For code readability especially, i (100% of the time) recommend property() be used for getting a "field" from a CDT, and index() be used for getting the index i.e. position within an array, when it's not 100% clear whether the array will have an entry at that index.

Children
No Data