1
0
-1

How do we pass array information in path parameter for Form.getpathdata function, Need to get value from repeat items specific array in this case getting first object Form.getPathData("data.packagerepeat[0]", data).  Please note path information is correct because if we remover the index info '[0]' we get complete repeat package object. 

    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      Hi,

      You don't need to pass array information in the path parameter.  getPathData returns the data object associated with the path, and for a repeat, this would be an array, so you can just index into that.

      For example, if your repeat contains a child field 'name', and you want the name field from the first repeat item, use:

          var firstName = Form.getPathData('data.repeat', data)[0].name


        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi,

        To get an array of values from an item in a repeat you can use the Form.getRepeatData method.

        You can right click an item within a repeat in a rule to access helper code

        Form.getRepeatData("Form.data.repeat.emailAddress", data)

        This will return an array of the data values.

        So to access to first instance you can go (might be worth checking the length of the array first too)

        var valueArr = Form.getRepeatData("Form.data.repeat.emailAddress", data),
        	firstEmail = "";
        
        
        if (valueArr.length) firstEmail = valueArr[0];
          CommentAdd your comment...