Creating a rule using a function
You create rules in the Rule Wizard. The Rule Wizard includes a Quick Start tab containing rule types, including constraint rule and calculation rule, which populate the Actions tab with information. You can override the default information and provide additional information.
Note: As you create a rule, the Rule Summary reflects the structure of the rule, including precondition, action, and expression information. Click a link in the Rule Summary to navigate through the Rule Wizard.
Step 1: Select a study object and open the Rule Wizard
- In the Project Explorer, select a study design (in a study only), study element, study event, form, section, or item.
The editor for the selected study object appears in the workspace.
- Select the Rules tab.
- Click New Rule.
The Rule Wizard appears with the Quick Start tab selected.
Step 2: Select the type of rule to create
- In the Select a rule type area, select Constraint Rule or Calculation Rule.
Note: Selecting a rule type populates information in the Actions tab. You can override the default information.
- Click Next.
The Properties tab appears.
Step 3: Name the rule
Step 4: Select the preconditions for the rule
- From the Evaluate on Event drop-down list, select one:
- Form submission—(Default selection) Rule executes on form submission. To figure out the form that causes the rule to execute, the InForm application determines rule dependencies by detecting the study objects on which the rule depends.
- On demand (batch mode)—Rule is validated and deployed to the InForm application with a deactivated status, so the rule does not run in the InForm application.
- Click Next.
The Expression tab appears.
Step 5: Create the rule expression using values from the dynamic expression prompt
- To use a function, type Functions., and select the function from the dynamic expression prompt.
The function name appears in the Expression workspace, along with a tooltip showing the syntax of the function.
- Provide values for the parameters:
- To provide a value, type it as a parenthetic expression following the function name.
- To use the value of a study object or rule model property, type this., and select the study object or property from the dynamic expression prompt.
- To use a constant, type Constants., and select the constant from the dynamic expression prompt.
- To use a data mapping study object or a rule model property, type DataMappings., and select the study object or rule model property from the dynamic expression prompt.
- To add other components to the rule expression, use the following:
- Operators and literals.
For more information, see Operators and literals (in the Rules Reference Guide).
- Study objects, rule model properties for study objects, constants, global study objects, or rule model properties for global study objects.
- To use the value of a study object or rule model property, type this., and select the study object or property from the dynamic expression prompt.
- To use a constant, type Constants., and select the constant from the dynamic expression prompt.
- To use a data mapping study object or a rule model property, type DataMappings., and select the study object or rule model property from the dynamic expression prompt.
For more information, see Rule Wizard—Option descriptions.
- Methods.
- To use a method for a repeating study object, type this., and select the method from the dynamic expression prompt.
- To use a method for a data mapping study object. type DataMappings., and select the method from the dynamic expression prompt.
- To use a math method, type the method in the Expression workspace.
For more information, see Methods (in the Rules Reference Guide).
- Click Next.
The Actions tab appears.
Note: In the Actions tab, you specify a condition and an action to take when the condition occurs.
or
Step 5: Create the rule expression by dragging values from the reference tabs
- Select the Functions tab, and drag the function you want to use for the rule expression to the Expression workspace.
The Invoke Function dialog box appears. It contains the parameters that must be defined for the expression.
- Provide values for the parameters.
- To provide a value, type it in the Value field.
- To use the value of a study object or a rule model property, drag the study object from the Data tab to the Expression workspace. To view the rule model properties of all of the study objects, click Show All.
- To use a constant, drag the constant from the Constants tab to the Expression workplace.
- To use a data mappping study object or a rule model property, drag the data mapping study object or rule model property from the Data Mappings tab to the Expression workspace.
For more information, see Rule Wizard—Option descriptions.
- Click OK.
You return to the Rule wizard. In the Expression workspace, the function name is preceded by the word Functions.
- To add other components to the rule expression, use the following:
- Operators and literals.
For more information, see Operators and literals (in the Rules Reference Guide).
- Study objects, rule model properties for study objects, constants, global study objects, or rule model properties for global study objects.
- To use the value of a study object or a rule model property, drag the study object from the Data tab to the Expression workspace. To view the rule model properties of all of the study objects, click Show All Properties.
- To use a constant, drag the constant from the Constants tab to the Expression workspace.
- To use a data mapping study object or a rule model property, drag the data mapping study object or rule model property from the Data Mappings tab to the Expression workspace.
For more information, see Rule Wizard—Option descriptions.
- Methods.
- To use a method for a repeating study object, drag the method from the Data tab to the Expression workspace.
- To use a method for a data mapping study object, drag the method from the Data Mappings tab to the Expression workspace.
- To use a math method, type the method in the Expression workspace.
For more information, see Methods (in the Rules Reference Guide).
- Click Next.
The Actions tab appears.
Note: In the Actions tab, you specify a condition and an action to take when the condition occurs.
Step 6: Define one or more actions for the rule
- From the If the value is section, select one of the following options:
- False—If the rule calculates a False value, the action occurs.
- True—If the rule calculates a True value, the action occurs.
- Always—(Default for calculation rules) The action always occurs.
- Only if no other action executes—The action occurs only if no other action occurs. Select this option only if you define at least two actions.
- Values to specify:
- Equals—If the rule calculates a value that is equal to the provided value, the action occurs.
- Not Equals—If the rule calculates a value that is not equal to the provided value, the action occurs.
- Less Than—If the rule calculates a value that is less than the provided value, the action occurs.
- Greater Than—If the rule calculates a value that is greater than the provided value, the action occurs.
- Between—If the rule calculates a value that is between the provided values, the action occurs.
- Inclusive checkbox—Select this option to make the number comparisons inclusive. For example, Less Than becomes Less Than or Equal To.
Note: You can include string values in the Equals and Not Equals fields. Enclose the string in double quotes. For example, "text".
- In the Execute these actions section, choose the action or actions that will occur when the rule executes.
Note: Instructions for defining a query, specifying email information, and setting a value follow this procedure.
- SetValue—(Default for calculation rules) Set the value of an item.
- Email—Send an email message to a distribution list.
- Query—Issue a query. A query is a text string that appears on a CRF item in the InForm application when a rule on that item fails.
- UpdateWorkflow—Recreate the state of a workflow rule. For more information, see Updating the state of a workflow rule.
- Optionally, to specify multiple actions, click Add Action. For more information, see Rules with multiple actions.
The condition and action to take appear in the Fire Event grid.
Step 6A: Defining a query
- In the Rule Summary section, click the query link.
The Query Action dialog box appears.
- From the Initial Query State drop-down list, select one:
- Open—The query is visible on the form and available for response.
- Candidate—The query is not visible on the form until someone reviews and explicitly opens it.
- In the Item field, type a value or drag an item from the Data tab to the field.
Note: You can type an expression in the Item field if it satisfies rule expression requirements. For more information, see About the rule expression language.
You cannot define a query on a fixed item.
- From the Locale drop-down list, select a locale.
- In the Message field, type the query message. Optionally, to use a parameter in the message, do the following in the Message Parameters section:
- To define a value for a parameter, either type a value or drag information from the Data, Functions, Constants, and Data Mappings tabs to the Value field.
- Select the parameter, and drag the parameter to the Message field.
or
Double-click the parameter.
The parameter is added to the message. Parameters are enclosed by curled braces.
- Click OK.
For more information, see Query Action dialog box—Option descriptions.
Step 6B: Specifying email information
- In the Rule Summary, click the email link, or press CTRL+M.
The Email Action dialog box appears.
- To choose the item that triggers the email action, either type a value or drag an item from the Data tab to the Item field.
Note: You cannot trigger an email action from a fixed item.
- Type the To email addresses, separated by semicolons.
- Type a From email address.
Note: If you do not provide an email address, an address is taken from the registry. If the registry does not contain an email address, <studyname>@<default_webserver> is used.
- Select a Locale.
- Type an email Subject and Message. Optionally, to use a parameter, create one or more parameters in the Message and Subject Parameters section:
- To define a value for a parameter, either type a value or drag information from the Data, Functions, Constants, and Globals tabs to the Value field.
- Select the parameter, and drag the parameter to the Message or Subject field.
The parameter is added to the message. Parameters are enclosed by curled braces.
- Click OK.
For more information, see Email Action dialog box—Option descriptions.
Step 6C: Setting a value
- In the Rule Summary section, click the [select] = value link.
The Set Value Action dialog box appears.
- In the Item field, type a value or drag an item from the Data tab.
Note: The value must be set on an item. You cannot set the value of a fixed item.
- In the Value to set the Item area, do one of the following:
- To use the value that is calculated in the expression, leave the default value text.
- To modify the value that is calculated in the expression, type a value or an expression that will return a value for the item. For example, value + 2 adds two to the value returned by the expression.
Note: You can type an expression in the Item field if it satisfies rule expression requirements. For more information, see About the rule expression language.
- Click OK.
Note: Set value actions run in the InForm software in the order in which you define them.
For more information, see Set Value Action dialog box—Option descriptions.
Step 6D: Setting the stage of a review state
- In the Rule Summary section, click the SetReviewState link.
The Set Review State Action dialog box appears.
- In the Form field, type a value or drag a form from the Data tab.
- From the ReviewState drop-down list, select a review state.
- Do one of the following:
- Select the Review Stage radio button, and select a review stage from the drop-down list.
- Select the Review Stage expression radio button, and in the text box, create a rule expression that evaluates to a valid review stage. You can use the objects and properties in the References window.
- Optionally, enter a comment in the Comment field.
- Click OK.
For more information, see Set Value Action dialog box—Option descriptions.
Step 7: Finish creating the rule
Copyright © 2013 Oracle and/or its affiliates. All rights reserved. |