************NOTE: this worked example section of the wiki is now out of date as GELLO is currently at R.2. This code will not work in later versions of the editor. We intend to update this section to R2 GELLO soon. ****************
GELLO code will be used to display an ELEMENT node or not. GELLO for node visibility can also be applied for CLUSTERs or data groups. This is important for:
Lets go back to the apple archetype. The example here will add GELLO node visibility to 'Total Cost'. When values have been entered for the higher nodes 'Cost' and 'Number', and the IsCalculated tag GELLO has calculated a value , we may decide its fair enough to make the node visible. Another example where node visibility is useful has been in the pathology domain, where calculation of certain values need only be done and displayed where certain other fields have been entered, eg the calculation of electronic glomerular filtration rate (eGFR).
Open CEN13606-Apple.v1.xml again. Set the VisibleAtStart metadata tag for 'Total Cost' on the RHS to false.
Here's a walk through of the GELLO required:
Usual beginning:
let o:observation = parameter[1] |
See if 'Cost' and 'Number' have values. This time we'll just retrieve them as the general type/class Observation:
let o1: Observation = if o.isdefined() then o.find_observation('1.2') else o endif let o2: Observation = if o.isdefined() then o.find_observation('1.3') else o endif |
Set up the test:
let VisA:boolean = if o1.isDefined() then if o1.value_asPQ().value > 0.0 then true else false endif else unknown endif |
let VisB:boolean = if o2.isDefined() then if o2.value_asReal() > 0.0 then true else false endif else unknown endif |
Run the test and return the result (as a boolean):
Let Result : Boolean = If VisA = true and VisB = true then true else false endif |
Result |