getReferenceAdded by IBM on August 8, 2013 | Version 1 (Original)
|Returns a reference for the element that contains the call. The function works as a "Where am I?" check for a page, item, or option. It is always called from within the element for which the reference is needed, but the returned reference can be for that element or any of its parents.
For example, getReference could be called from within a page’s label , and return a reference for that option (for example, PAGE1.global.label), its parent item (for example, PAGE1.global), or the page it is on (for example, PAGE1).
This function is especially useful when duplicating pages, because new pages contain identical options and items as their originals.
Table 1. getReference parameters
getReference(element, type, level, scheme)
|element||String||The element that you want to identify. Possible values include the page scope identifier (sid), the item or option type, and the name or value of the item or option. For instance, to return the reference for a label option containing the call, the element parameter would be "label".|
|type||String||The element type. This is one of page, item, option, or array.|
|level||String||The level in the reference for the function to return. If the function is called from an option, but the level is identified as item, the reference returned would be "page.item".|
|scheme||String||Optional. The referencing scheme used. The default setting is XFDL.|
Returns A reference to the element (page, item, or option) from which the function was called, or an empty string if an error occurs.
Example In this example, getReference returns a reference to the page, which is PAGE1.
In this example, getReference returns a reference to the label option, which in this case is PAGE1.global.label.
<label compute="getReference('label', 'option', 'page')"
<label compute="getReference('label', 'option', 'option')"