-
Notifications
You must be signed in to change notification settings - Fork 4
Tutorial
The purpose of this tutorial is to show how to build templates, use FormScript, and report in XReport.
To add a new template click on the card with the plus icon. This will navigate you to the editor page, and you can start working on your template.
When you're on the editor screen you can start with adding a name to your template. Type the name in the input field on top of the form, then start adding components. After you finished building the template, click on the green accept button, or discard the template with the red button.
By clicking on the "plus" button on the bottom of the form, a drop-down menu will open with all the form elements you can choose from.
- Text field: simple text input, allows any alphanumerical characters
- Plain text: non-editable text, can be used to show additional information about a question
- Number field: numerical input, allows only numbers
- Calculated field: non-editable, can be used to show the output of a calculation executed in FormScript, for example:
numLymphNodes = numMesorectal + numExtraMesoractal, wherenumLyphNodesis the scriptAlias for the calculated field,numMesorectalandnumExtraMesorectalare number fields - Boolean field: a simple checkbox, can be used for "Yes/No" questions
- Single choice field: shows a list of options where only one can be selected
- Dropdown: same as the single choice field, but with a dropdown menu visual appearance
- Multiple choice field: shows a list of options where multiple options can be selected
- Textarea: used to allow the user to input text that may span multiple lines
- Date: used to input date
- Header: used the visually separate sections
- Information: non-editable text, similar to plain text, but it will be only shown if the user clicks on the question mark
- Rating scale: tabular input format, see details later in the tutorial
- Image: provided an url, it will show the image
To edit or delete a component bring your cursor over it. A pencil and a minus icon will show. Click on the pencil to edit, and on the minus icon to delete the field.
The following properties are editable:
- Field name: the label which will be visible on the form
- Script alias: the variable name by which we can access a field from FormScript code
- Options: here you can list the options the user can select from for the given single choice, or multiple choice field. The options should be semi-colon separated.
After your modifications click on "Save", then on the "X" icon in the top-right corner of the field editor.
Rating scales show inputs in tabular format. You can use them to add a grading system, or simply to group questions that logically belong together.
The following properties are editable:
- Script alias: the variable name by which we can access a field from FormScript code
- Title: this is the name of the rating scale
- Values (text): these are the names of the columns, the input values in text format
- Values (scores): these are the scores associated to each column
- Parameters: these are the names of the rows, or you can think of these as the questions the user wants to ask
You can attach small code snipets to the templates to make them dynamic. To go to script editing click on the button in the top right corner of the form.
After clicking on the button the editor window is shown.
The conditional part of the statement has an XReport form element on the left side, and a value on the right side. The value can either be a string or a number.
The body of the statement contains a list of statements, other than if statement.
The else part is automatically generated behind the scenes. In the example above, the else part would be otherField.hide().
if inputField == "value" {
otherField.show();
}In FormScript you can only call predfined functions. Every XReport form element has a .show() and a .hide() method. There are also element specific methods:
- Single choice, multiple choice, dropdown fields:
checkOption(),uncheckOption(),showOption(),hideOption() - Rating scale:
.sum(),.min(),.max()
The function calls can be defined and modified by the developer.
In FormScript it's very simple to add numerical fields and assign the value to another field:
calcOutput = input1 + input2
For calculation outputs use the calculated field.
When you click on an existing template, it will open in reporting mode. It means that you can't modify the template, you can only fill the form, and copy the output.
Clicking on the topmost button in the buttongroup makes the template toggle between reporting and output mode. The button below that copies the content of the report to clipboard, so that it can be inserted to a HIS or any other place. The report format was chosen to be simple so that it can be pasted into other systems with the layout remaining intact. Clicking on the green plus button you can start another report: the form's values will be reset. You can share a template by clicking on the blue share icon. This will put the link of the template (not the report!) to the clipboard so you can share it with fellow radiologists.