Summary

This article covers a script example for when subject is enrolled. 

Table of Contents


Description


When a subject is set as enrolled, this script creates the specified forms with certain properties. Parent is a path to the parent form under which the form will get created. The type property indicates the form type for the form that is to be created. The alias property sets the alias of the new form. The sequence property specifies where the form should be inserted into the list of forms already under the new forms parent. If sequence is not specified, the form will be inserted in the sequence that is set in the dataArchitect file.


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 all forms requested. 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="createEnrolledCasebook">
    <body>
        <s:if>
            <s:and>
            <s:isSet>                       
                <s:question>
                    <s:question path=".enrollyn"/>
                </s:question>                           
            </s:isSet>
            <s:eq>
                <s:numberPath path=".enrollyn:value"/>
                <s:number value="1"/>
            </s:eq>
            </s:and>            
            <s:list>
                <s:createForm>
                    <s:parent>
                        <s:form path="/screening"/>
                    </s:parent>
                    <s:type>
                        <s:string value="mri"/>
                    </s:type>
                    <s:alias>
                        <s:string value="mriScr"/>
                    </s:alias>
                    <s:sequence>
                        <s:number value="6"/>
                    </s:sequence>
                </s:createForm>
                <s:createForm>
                    <s:parent>
                        <s:form path="/screening"/>
                    </s:parent>
                    <s:type>
                        <s:string value="photo"/>
                    </s:type>
                    <s:alias>
                        <s:string value="photoScr"/>
                    </s:alias>
                    <s:sequence>
                            <s:number value="7"/>
                    </s:sequence>
                </s:createForm>
                <s:createForm>
                    <s:parent>
                        <s:record/>
                    </s:parent>
                    <s:type>
                        <s:string value="operation"/>
                    </s:type>
                    <s:alias>
                        <s:string value="operation"/>
                    </s:alias>
                    <s:sequence>
                            <s:number value="1"/>
                    </s:sequence>
                </s:createForm>
            </s:list>
        </s:if>
    </body>
    <target typeId="eligblty" when="after" shouldReconcile='true'/>
</script>



Need more help?

Please visit the Fountayn Contact Information page.