State Form Definition
Import, export, create, and/or modify state forms layouts. With this form users can add definitions to myAvatar that instruct the system on how to compile data into user-defined state forms layouts.
Users can define a form in several steps, specifying the record layout and data content for file generation. The files are then compiled and created with the State Form File Generation form.
-
Go to: RADplus Utilities > State Forms Tools
-
In the New or Existing field:
- Select New to add a new definition.
- Select Existing to edit an existing definition.
- Select Existing (Active Only) to edit an active existing definition.
Note: When selecting a state form definition, if the user does not have access to all the tables contained in the definition, they will be prompted to deactivate the definition. If Yes is selected, the definition will be deactivated and will no longer appear in the drop-down list if Existing (Active Only) is selected.
- For new definitions:
- Enter a State Form Name. This is a descriptive name that will not appear in the file.
- Select the File Type. This determines the format of the state form being created.
- If Delimited is selected, the Delimited Setup section of the form will become visible. Specify the Record Delimiter to be placed between each record within the file. In the Other field, enter the custom delimiter if applicable.
- If Positional is selected, the Character Range will be required within the Define Record Data Elements grid.
- If XML is selected, the XML Setup section will become visible. Enter a Root Tag if applicable, and any attributes needed.
- If Flat XML (Populate) is selected, most fields are hidden with only the State Form Name, State Form Record Layout, Root Tag, and Deactivate fields visible on the form.
Note: The Flat XML (Populate) file type simplifies the configuration needed to generate a simple XML file. A file created as Flat XML will have all data extracted contained in one record.
- For existing definitions, select the form from the Select State Form drop-down. This populates the State Form Name and File Type fields.
- Once a form is defined or selected, the State Form Record Layout field is populated with the layout of the form definition items.
- In the Output as Multiple Files field, indicate whether multiple files should be created as part of State Form File Generation.
-
If Yes, multiple files will be created, one for each top-level record. File names will be required on a per record basis.
- In the File Path field, enter the directory location where the output files will be created.
Note: To avoid errors, the directory must be created prior to State Form Definition. - In the Multiple File Format field:
- Select One File Per Record to create one file for each top level record in the definition. The name of each file can be specified in the Output File Name field on the Record Definition section.
- Select One File Per Data Row to create one file for each data row in a top level record. The name of each file will be generated using the Output File Name and the number of the data row. For example, for a top level record with the Output File Name of 'Test.txt', the first data row would be placed in a file called 'Test_1.txt', the second in a file called 'Test_2.txt' and so on.
-
If No is selected, enter the File Path. Then in the File Name field enter the name of the file that will be created upon State Form File Generation.
- The file name must include a valid extension.
- If the File Path and File Name fields are left blank during State Form Definition, the user will be prompted to select a directory and enter a file name at file generation.
-
- In the File Suffix field, select the format to use for a suffix added to the file name. The 'XXX' in the suffix represents a unique three-digit counter added to the file name for definitions with a predefined file path. Each time the file is created for the same compile, the counter is incremented by one. (It is not necessary to compile each time in order to increment the counter. Just create the file for the same compile.)
- In the Report field, select the report to be used when Run Report is selected on the State Form File Generation form. The drop-down contains a list of the reports added through the Import Reports or Import Reports for Command Button Launch form.
- The State Specific Logic field may be used to specify custom logic to be run when the form is compiled. Generally, this has been used to perform complex logic to populate table with temporary data that can then be used in the definition. New entries in this field will need to be added by development.
- In the Definition Options field, select options to apply to the state form definition.
- Select Treat Definition As Single Record if the state form definition contains multiple records, but the definition has a single record structure. Note: When a child record has a missing required field, the state form definition will skip the associated top-level row and all rows under that row.
- Select Require From/Through Dates for File Generation to make the From Date and Through Date fields required when the definition is compiled with the State Form File Generation form.
- Select Full Error Catching so records skipped for any reason during file compilation will still be processed in order to see if they contain errors. The skipped records will still be excluded from the output file.
- Select Remove XML Declaration in order to remove the
that is present by default for XML files.
- The Next Batch Number field can be used to set the batch number that will be used the next time the definition is compiled. It must be greater than the highest batch number for a previous compile.
- Click File Form to file the definition.
- Select Existing in the New or Existing field and select the newly created definition.
- Go to the Record Definition section to define the records for the form.
Record Definition
- In the Add or Update Record field, select Add.
- In the Record Name field, enter a name for the record. This is a descriptive name that will not appear in the file.
- In the Select Record to Place Under field, select the parent record under which the record will be printed. For records with no parent, the drop-down list will have a (Top Level) entry to select. Placing under will print the record underneath each row returned for the parent record.
It is recommended to define the parent records before their subrecords. Field hierarchy and order can be rearranged later, but this will save additional/unnecessary edits.
- If the Output as Multiple Files? field in the State Form Definition section is set to Yes, a file name must be supplied for (Top Level) records.
- In the Select Record to Place After field, select the record that will be printed after all rows of the previous record have been printed. Select (First Record) from the drop-down for the first record or subrecord in a definition.
It is recommended to define the parent records before their subrecords. Field hierarchy and order can be rearranged later, but this will save additional/unnecessary edits. - In the Require Record field, specify whether the record should be required for the file to be created.
- If Conditionally is selected, enter the SQL condition in the Require Record Condition field that will determine whether a record is required for a file to be created. This field can be found at the bottom of the form
Example: ''SYSTEM.patient_current_demographics.age'>18'' would limit the requirement to records where the client is an adult. Any tables/properties referenced should be included in the record or one of the parent records. - The format for entering the SQL condition is an operand, followed by an operator, followed by another operand. The operand related to a table property needs to be written as 'SCHEMA.tablename.property'. The second operand could be another property for comparison or a value. Examples: ''SYSTEM.user_patient_conditions.Diabetic='Y'" or "SYSTEM.admission_data.admission_date<system.admission_data.date_of_entry".>
- If Conditionally is selected, enter the SQL condition in the Require Record Condition field that will determine whether a record is required for a file to be created. This field can be found at the bottom of the form
- Click the Define Record Tables button to designate the tables where the data exists for this record. This will display the Define Record Tables grid.
- Click the Define Record Data Elements button. This will display the Define Record Data Elements grid.
- In the XML Tag field, if the file type is XML, enter the XML tag to be associated with this record.
- In the Is This Record A Subrecord field, select Yes to designate this record as a subrecord. This functionality can be used if the file type is either delimited or XML and the record is placed under another record.
- If Yes is selected, the record will not be included in the output file by default. In order to be included, it must be added as a data element to the record it is placed under.
- If No is selected, the record will be processed normally.
- If the file type is Delimited, enter the field delimiter in the Field Delimiter field. If you select 'Other', specify the delimiter in the Other field.
- If the current record is placed under another record, the Join to Parent Record field may be used to filter the results based on the data of the parent record row when the file is compiled. Select Yes to filter the results, or No to pull all valid data for the record.
- In the Join to Parent Table field, select a shared table that allows the current record to be joined to the parent record using the Table Row ID of any table that is shared between the two records.
- If a value is selected, the records will be joined on the ID Key field of the table.
- If no value is selected, the records will be joined on the Entity ID and Episode fields of the primary table of the current record and its parent.
- In the Record Id field:
- The Record Id number may be used to get a row count in the output file for a specific record or set of records.
For example, for a record with an id of 15, a constant value of <_x005F_x0031_5> can be entered to get a count of all rows in the output file coming from record 15.
- Multiple records should be separated with a comma (for example, <rowcount:15,16>).
- The Record Id number may be used to get a row count in the output file for a specific record or set of records.
- In the Is This Record a Deletion Record field:
- Select Yes to specify whether the record is a deletion record. A deletion record will compile data that has been deleted from the system. Then, in the Select Original Record field, choose the record containing the information the deleted records will be verified against.
- Select Conditionally if the record is a deletion record only under a certain condition.
- In the Delete Record Condition field, enter an SQL statement that defines the condition for creating deletion records.
Note: The SQL statement should contain an operand, then a operator, then another operand. The first operand, which relates to a table property, needs to be written as 'SCHEMA.tablename.property'. The second operand can be a value, or another property, to be used for comparison. - In the Select Original Record field, select the record that contains information the deleted records will be verified against.
- Enter any comments for the record in the Record Comment field. These comments are purely for reference and do not appear anywhere in the file.
- Click File Record.
