Summary

This command evaluates a boolean command inside the if command. 


This first command can be a simple check or more complex if used with an and or an or command that returns a boolean result. If the logic in the first command returns true, it will executed the next command. If a third command is present, this will be evaluated as the ‘else’ logic. Multiple commands can be executed in the positive or else block if combined with a list command.

Attributes

  • none

Parameters

  • one boolean command
  • one command (positive condition)
  • one command (optional ‘else’ condition)

Example

<script scriptId="set-age">
    <body>
        <s:if>
            <s:and>
                <s:isSet>
                    <s:question>
                        <s:question path="/baseline/dm.dobdtc"/>
                    </s:question>
                </s:isSet>
                <s:isSet>
                    <s:question>
                        <s:question path="/baseline/ic.icdtc"/>
                    </s:question>
                </s:isSet>
            </s:and>
            <s:assign>
                <s:question path="/baseline/dm.age"/>
                <s:toString>
                    <s:dateDiff unit="year" method="integer" last="hour">
                        <s:from>
                            <s:datePath path="/baseline/dm.dobdtc:value"/>
                        </s:from>
                        <s:to>
                            <s:datePath path="/baseline/ic.icdtc:value"/>
                        </s:to>
                    </s:dateDiff>
                </s:toString>
            </s:assign>
            <s:assign>
                <s:question path="/baseline/dm.age"/>
                <s:string value="" />
            </s:assign>
        </s:if>
    </body>
    <target typeId="dobdtc" when="after" shouldReconcile='true' />
    <target typeId="icdtc" when="after" shouldReconcile='true' />
</script>



Need more help?

Please visit the Fountayn Contact Information page.