If Then Logic
If there is a particular field that is required in a state form, the below steps can be utilized to perform “If, Then” logic in State Form Definition.
Feature
The following is a use case of “If, Then” logic for State Forms Tools. Here, we're viewing an example of patient contact date. If there is a section where a particular field or data is required, the following logic can be utilized to perform “If, Then” logic within the State Reporting Tools.
The below logic will be applied to the situation below:
- If there is a service, use service date.
- If the service date field is null, then report the admission date for the service date.
This logic can be accomplished by utilizing two separate lines in the Define Record Data Elements grid. Both lines will have the same element name, with a “*” preceding the name. This is a convention in order to indicate at a glance that only one of the elements will be output in the file.
The remove element condition to add to the first section (e.g. *4) will be similar to the following: "SD.servicedate IS NULL". The second remove element condition (*4.01), where the admission date will print if the service date is null, will be similar to the following: "SD.servicedate IS NOT NULL". Please keep in mind that these conditions are for removing the line, rather than outputting the line in the state form.
It is best practice to make these conditions exact negations of each other so that exactly one of the lines will output every time.
- To negate a condition containing an 'AND' or 'OR': Flip the 'AND' to 'OR' or 'OR' to 'AND', and then negate each part of the condition
- Example: p.PATID IS NULL & p.program_code = 100
- Flip the 'AND' or 'OR'
- p.PATID IS NULL \ p.program_code = 100
- Negate each piece
- p.PATID IS NOT NULL \ p.program_code != 100
- Flip the 'AND' or 'OR'
Figure 1: "If, Then" Logic

