Summary

The merge and default options enhance your ability to compare value and define default values for comparison. 

Table of Contents


merge


Description

The merge option enhances your ability to compare values. Using a comparison command such as eq or lt on its own would allow you to compare two values, A vs. B. The merge attribute makes it possible to compare many values in one step. It is often used to check a value that exists on dynamic forms.

Example

For example, if you needed to determine if any Adverse Event outcome was ‘death’, set the attribute to merge=”or” as seen below. Set merge to “and” to evaluate if every instance of a question met your comparison criteria.

<script scriptId="deathReasonCheck">
    <body>
        <s:alert>
            <s:expression>
                <s:or>
                    <s:not> 
                    <s:eq merge="or"> 
                     <s:numberPath path="/aesum/ae[n].aeoutcme:value"/> 
                     <s:number value="6"/> 
                    </s:eq>

default


Description

The purpose of “default” is to specify what value the comparison should return if one of the elements being compared is null (question doesn’t exist, value is not usable, etc.). If the comparison should fail because one of the items you are comparing is null, then the default value will be returned.

If default = true and the comparison has a null item, the will return true.
If default = false and the comparison has a null item, the will return false.

If no default value is provided, the following error will be reported and the eq command will return false:
Comparison cannot be performed with null values.

Typically, isSet commands are being used to ensure that the alert only processes when the relevant questions have been answered. There is only a need to specify a default value if you need the specific behavior described above. Otherwise it should be left off.

<script scriptId="deathReasonCheck">
<body>
<s:alert>
<s:expression>
<s:or>
<s:not>
<s:eq merge="or" default="true">
<s:numberPath path="/aesum/ae[n].aeoutcme:value"/>
<s:number value="6"/>
</s:eq>


Note: If the casebook is dynamic, the script should check that the forms exist or the ‘default’ attribute will return true for those items.



Need more help?

Please visit the Fountayn Contact Information page.