Summary
The drugAssign script command executes a drug assignment.
Table of Contents
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. The drugAssign command will perform an assignment of the drug type that is associated with this treatmentType’s value as resolved from the configuration.
Note: If treatmentType is set and the subject is randomized/activated, the script will assign the treatment defined by the treatmentType attribute and not use the randomized to treatment. Setting a treatment type will overwrite the randomization assigned to treatment type.
- overrideFreeze – (boolean, optional)
If set to ‘true’, the overrideFreeze attribute allows for the execution of a drug assignment and write 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, the drug assignment fails.
The assignment fails if the question is locked.
The default logic for this attribute is false. - description – (String, optional)
The description attribute sets the Drug Assignment ‘Description’ value viewable in the Drug Assignments manager.
Parameters
- question path - the form path where the script should write the kit(s) assigned. The question’s data type must be a string, otherwise the assignment is not executed.
The assignment will also fail if the path already has a value or if it is invalid.
Note: While the drug assign script command will fail if the question path already has a value, a manual assignment done through the ‘Actions’ \ ‘Assign Drug’ menu will allow for additional assignments (for the same visit / path). An assignment cancellation will remove cancelled kits written in the question path.
- drugType, drugAmount(optional, multiple)– define 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.
The drugType parameter’s typeID attribute defines the assignment’s drug type and must match one of the ‘Drug Type ID’ from the dataArchitect / configuration. While the most common implementation defines the drug type as an integer, a string is accepted as well.
The drugType parameter must be unique; if not, a compiler error will be shown. However, the compiler is not checking if the script drugType matches the drug Type ID in the configuration.
The drugAmount parameter defines the quantity of drug associated with the command’s drugType.
The drugAmount must resolve to an integer greater than zero.
The drug amount can be defined by using:
- a static amount (Ex: ),
- a path to a eCRF number variable, Ex: <s:numberPath path=”.assignAmmount1:value”/>)
- a script expression/command that further calculates the drug amount
Note: If treatmentType is not set, the drugAssign will perform an assignment only on a randomized/activated subject. If treatmentType is not set and the subject is not randomized/activated, the script will not perform an assignment.
Example
<script scriptId="assignDrugVisit1"> <body> <s:if> <s:and> <s:eq> <s:numberPath path=":id" /> <s:numberPath path="/visit1v.assignyn:id" /> </s:eq> <s:isSet /> <s:eq> <s:stringPath path=".assignyn:value" /> <s:string value="Y"/> </s:eq> </s:and> <s:drugAssign treatmentType="1" overrideFreeze="false" description="Visit1"> <s:question path="/visit1v.assignkits" /> <s:drugType typeID="1"> <s:drugAmount> <s:number value="1" /> </s:drugAmount> </s:drugType> </s:drugAssign> </s:if> </body> <target action="update" shouldReconcile="false" typeId="assignyn" when="after"/> </script>
Note: A drugAssign script cannot be triggered from a dependent path statement. Therefore, all questions that should trigger the reevaluation of the script should be listed as targets. Additionally, a drug assignment script cannot be executed from a reconcile; therefore, all drug assignment scripts shall have the shouldReconcile=”false” parameter (the compiler will note this error).
Need more help?
Please visit the Fountayn Contact Information page.