Summary

This article covers a script example of checking interval (X +/- n minutes).

Table of Contents


Description

This script checks to make sure that the Blood Draw 2 hour post-dose time at Day 1 is 2 hours plus or minus 3 minutes after the Day 1 morning dosing time. The script uses the addDate command to add the dosing date with the minutes for the time window and then compares that result to the target, evtm3. The “:id” comparison is needed to determine that this script should only evaluate for targets with an id that is for the Blood Draw 2 hour post-dose time at Day 1. Listing dependent question paths allow the script to trigger when a dependent variable existing on another form is updated with a new value.

Script

<script scriptId="bd2HrCk">
    <body>
        <s:alert>
            <s:expression>
                <s:or>
                    <s:ne>
                        <s:numberPath path=":id"/>
                        <s:numberPath path="/day1/bd1.evtm3:id"/>
                    </s:ne>
                    <s:not>
                        <s:isSet/>
                    </s:not>
                    <s:not>
                        <s:isSet>
                            <s:question>
                                <s:question path="/day1/ex1.strttm3M"/>
                            </s:question>
                        </s:isSet>
                    </s:not>
                    <s:and>
                        <s:gte>
                            <s:datePath path=":value"/>
                            <s:addDate>
                                <s:date>
                                    <s:datePath path="/day1/ex1.strttm3M:value"/>
                                </s:date>
                                <s:minutes>
                                    <s:number value="117"/>
                                </s:minutes>
                            </s:addDate>
                        </s:gte>
                        <s:lte>
                            <s:datePath path=":value"/>
                            <s:addDate>
                                <s:date>
                                    <s:datePath path="/day1/ex1.strttm3M:value"/>
                                </s:date>
                                <s:minutes>
                                    <s:number value="123"/>
                                </s:minutes>
                            </s:addDate>
                        </s:lte>
                    </s:and>
                </s:or>
            </s:expression>
            <s:correction>
                <s:string value="optional"/>
            </s:correction>
            <s:text>
                <s:string value="Blood draw 2 h post-dose actual time is not within the
                 expected time window (2 hrs plus or minus 3 minutes) of the morning
                 dose administration time.  Please clarify."/>
            </s:text>
        </s:alert>
    </body>
    <target typeId="evtm3" when="preprocess" shouldReconcile="true"/>
    <dependent path="/day1/ex1.strttm3M"/>
</script>



Need more help?

Please visit the Fountayn Contact Information page.