Today I came across one of the hidden features of Index Functoid that I feel worth to share.
We all know how to use Index Functoid to extract values at a particular index in a repeating record. We do this by configuring an index Functoid with two inputs (generally)
1. The repeating record’s element
2. Index value (starts with 1)
However, after reading the full functoid description, I was interested in the highlighted text which mean, index functoid can take >2 parameters depending on the depth of the hierarchy of the source schema. To explore more, consider a sample input like below.
Input has 3 departments HR, Admin & Sales. Consider the below simple map.
So, it extracted the First Departments, first Employee.
Let us say, you want to extract the value “HREmployee1”.
Changing your index functoid input to “Name” & “2” will not give you a result. This is the trick. You should extract the first element of second employee record of first department.
Input: “Name”, “1”, “2”
Output 2: You get “HREmployee1”
Let us say, you want to extract the value “AdminEmployee2”.
Input should be: “Name”,1,3,2 (2 is for 2nd department)
One way to easily understand this is to look at the XSLT generated.
Hope this gives you an idea of extracting hierarchical values from source.