Summary

This article covers a script example to insert pregnancy test form. 

Table of Contents


Description

This script is meant to insert the pregnancy test form based on the patient’s demographic data. In this case, this script will look at the demography form of the casebook and see if the response to a question regarding the ability for the patient to be child bearing is true or not. If the patient is of child bearing potential, it will insert a pregnancy test form into visit 1 and the final visit. The target is the child bearing potential question and it will be evaluated when the demography form is saved (that is the location of the question).

This script also takes advantage of the “list” command. This command can be used on several commands which allows you “stack” commands to be executed one after another. In this case, if the result of the “if” command is true, it will create both forms. The “list” command is not needed when only a single form is to be loaded.

Note: If the created form ignores the set sequence in the dataArchitect file and gets added to the bottom of the tree, please check that the form alias value listed in the script correctly matches the formId listed in the dataArchitect file.

 

Script

<script scriptId="pregform">
    <body>
        <s:if>
            <s:and>
                <s:isSet/>
                <s:eq>
                    <s:numberPath path=".dmchild:value"/>
                    <s:number value="0"/>
                </s:eq>
            </s:and>
            <s:list>
                <s:createForm>
                    <s:parent>
                        <s:form path="/v01"/>
                    </s:parent>
                    <s:type>
                        <s:string value="pregser"/>
                    </s:type>
                    <s:alias>
                        <s:string value="pregser1v"/>
                    </s:alias>
                </s:createForm>
                <s:createForm>
                    <s:parent>
                        <s:form path="/final"/>
                    </s:parent>
                    <s:type>
                        <s:string value="pregser"/>
                    </s:type>
                    <s:alias>
                        <s:string value="pregserfin"/>
                    </s:alias>
                </s:createForm>
            </s:list>
        </s:if>
    </body>
    <target typeId="dmchild" when="after" shouldReconcile='true'/>
</script>

Need more help?

Please visit the Fountayn Contact Information page.