getPositionAdded by IBM on October 10, 2012 | Version 1 (Original)
|Returns the position index for an element within its parent.
For example, if a page contained two fields, and you called this function on the second field, it would return a value of "1", indicating that it was the second child. Note that indexing is zero-based.
Table 1. getPosition parameters
getPosition(reference, type, scheme)
|reference||Reference string||A reference to the element whose position you want to determine.|
|type||String||The type of reference used. This is one of page, item, option, or array.|
|scheme||String||Optional. The referencing scheme used. Valid options are XFDL and xforms. The default value is XFDL.|
Returns An integer representing the position of the element within its parent or an empty string if an error occurs.
Example This example uses getPosition to determine the position index of the lastNameField on the first page. It then adds one to the index to change it from zero-based indexing to one-based indexing, and concatenates that value into a string that reads: "The lastNameField is element #2 on page one."
<value compute="'The lastNameField is element #' +.
(getPosition('Page1.lastNameField', 'item') + 1)
+. ' on page one.'"></value>