Summary

The drugAssignCheck script command will test if the assignment can be successfully performed; its return value should be used as a way to execute the drugAssign and/or to notify the user of a failure, and identify the reason if necessary.


The drugAssignCheck command returns values as follows:

  • a fault code if a question path is locked, frozen and overrideFreeze is not set to true, in case of any misconfiguration or missing applicable data (drug quantity if not hardcoded), out of inventory, and any other reason the drug assignment cannot be performed.
  • the value of the question path (if any value, such as an already processed drug assignment already exists at that path).
  • blank if drugAssign can be successfully performed.

In order for the script to correctly evaluate if a drug assignment can be executed, the drugAssignCheck command should be used with the same attributes and logic as defined in the drugAssign script.

See Triggering Inventory Assignment with a Script for important information and considerations when using scripts to execute a Drug Assignment.

Attributes

  • treatmentType – (Integer, optional).

    If set, the treatmentType defines the matching ‘Treatment Type ID’ from the dataArchitect / configuration.


  • overrideFreeze – (boolean, optional)

    If set to ‘true’, the overrideFreeze attribute allows for the execution of a drug assignment and the writing of the value of the assignment onto a frozen question (the path of the question as defined by the ‘question path’ parameter).
    If the question path is frozen and this property is not set to true, or it is set to false, drugAssignmentCheck fails.

    The check fails if the question is locked.
    The default logic for this attribute is false.

Parameters

  • question path - the location where the kit assignment will be stored.
  • drugType, drugAmount (optional, multiple)– defines the assignment drug types/drug quantities value pairs. The drugAssign script command allows for none, one, or many parameters. The statements must be unique by drugType. See drugAssign for more information on these parameters.

Example

<script scriptId="drugAssignCheckVisit1">
    <body>
        <s:alert>
            <s:expression>
                <s:or>
                    <s:ne>
                        <s:numberPath path=":id" />
                        <s:numberPath path="/visit1v.assignyn:id" />
                    </s:ne>
                    <s:not>
                        <s:isSet />
                    </s:not>
                    <s:ne>
                        <s:stringPath path=".assignyn:value" />
                        <s:string value="Y"/>
                    </s:ne>
                    <s:eq>
                         <s:drugAssignCheck treatmentType="1" overrideFreeze="false">
                            <s:question path="/visit1v.assignkits" />
                            <s:drugType typeID="1">
                                <s:drugAmount>
                                    <s:number value="1" />
                               </s:drugAmount>
                             </s:drugType>
                        </s:drugAssignCheck>
                        <s:string value="" />
                    </s:eq>
                </s:or>
            </s:expression>
            <s:correction>
                <s:string value="optional"/>
            </s:correction>
            <s:text>
                <s:concat>
                    <s:string value="Drug assignment cannot complete. Please check stock and configuration. (Error: "/>
                    <s:drugAssignCheck treatmentType="1" overrideFreeze="false">
                        <s:question path="/visit1v.assignkits" />
                        <s:drugType typeID="1">
                            <s:drugAmount>
                                <s:number value="1" />
                            </s:drugAmount>
                        </s:drugType>
                    </s:drugAssignCheck>
                    <s:string value=")."/>
                </s:concat>
            </s:text>
        </s:alert>
    </body>
    <target action="update" typeId="assignyn" when="preprocess"/>
    <dependent path="/visit1v.assignkits"/>
</script>



Need more help?

Please visit the Fountayn Contact Information page.