Mobile reports for Resco Inspections

From Resco's Wiki
Jump to navigation Jump to search
Resco Inspections

Traditionally, inspections often involved a lot of paperwork - part of it in the field, and then again in the office, producing a report. Resco Inspections is designed to perform the entire inspection process without any paper documents, however, in many scenarios, it is desirable to finish the inspection with a report, a document that can be sent to your manager or end customer. Fortunately, Resco Inspections allows you to generate such reports directly on your device, immediately after concluding an inspection.

Resco Inspections comes with a generic report available automatically for all questionnaires. You can customize the report directly in the Questionnaire Designer. For the most advanced use cases, you can use the Report Designer.

Generic report (legacy)

The demo data includes a generic report that can be used for any questionnaire, also known as AutomaticReport. This generic report is included in app projects that have Inspections enabled by default. For app projects that don't include inspections out-of-the-box, you can add it via Woodford using the Install Report button (on the Inspections screen).

Before releasing new automatic reports that are customizable in the Questionnaire Designer, this generic report used to be available for all reports without any configuration. This is no longer true. Use the Report Designer to associate the AutomaticReport with a questionnaire.

Select the questionnaire associated with the report.png

This generic report covers the scenario "one answered questionnaire = one report". If you want to cover multiple answered questionnaires in a single report, contact Resco support. For some platforms, we have created an experimental automatic report for a list of questionnaires.

Editing questionnaire reports in the Questionnaire Designer

The following configuration options are available for customizing your reports directly in the Questionnaire Designer.

What to include

For each question, set whether it should be included in the report or not (in the Show on report parameter on the Properties pane).

Style and themes

Questionnaire reports come with pre-configured styles and themes.

  • To assign styles to questions, select a question, and on the Properties pane, set the reporting style.
  • To assign styles to header and footer, select the top element of the questionnaire and set the header and footer style on the Properties pane.
  • To modify styles manually, click Styles in the toolbar, switch to the Report Styles pane, and set the font, colors, and arrangement of question and answer. See Style editor for general information about styles.
  • To switch between pre-defined report themes, click Report Themes in the toolbar and select one of the themes. Selecting a new theme discards all changes in custom styles.

Group properties

One of the big shortcomings of the generic report is how question groups are displayed. Therefore, the report customization in the Questionnaire Designer offers multiple options for displaying groups. To configure these, select a question group and modify parameters in the Reporting section on the Properties pane.

Reporting properties in the questionnaire designer.png

The first two parameters, Show Header and Header Style, allow you to select if and how should the group header be displayed in the report.

The Questions Layout determines how the questions should be arranged:

  • Horizontal: questions are arranged next to each other in a row
  • Vertical: questions are arranged one below the other in a column
  • Custom: design your own layout (not available with Salesforce backend)
Horizontal layout
Question 1 Answer 1 Question 2 Answer 2 Question 3 Answer 3
Vertical layout
Question 1 Answer 1
Question 2 Answer 2
Question 3 Answer 3
Custom layout
Questionnaire reports editing custom layout.png

In the Break After, specify how many questions should be listed in a single column or row before continuing to the next column or row. Note the different numbering order.

Horizontal layout, Break After = 3
Question 1 Answer 1 Question 2 Answer 2 Question 3 Answer 3
Question 4 Answer 4 Question 5 Answer 5
Vertical layout, Break After = 3
Question 1 Answer 1 Question 4 Answer 4
Question 2 Answer 2 Question 5 Answer 5
Question 3 Answer 3

Border Kind and Line Color determine if and how table cell borders should be drawn. The following options are supported:

  • Grid
  • Rows
  • Columns
  • Outside Border
  • No Border

For repeatable groups, you can additionally configure the Repeat Layout.

  • Default – each instance of a repeating group is rendered as a separate group with its own header
  • Compact – all instances of a repeatable group share a single header
Default horizontal
Question 1 Answer 1 Question 2 Answer 2 Question 3 Answer 3
Default horizontal
Question 1 Answer 1 Question 2 Answer 2 Question 3 Answer 3
Default horizontal
Question 1 Answer 1 Question 2 Answer 2 Question 3 Answer 3
Default vertical
Question 1 Answer 1
Question 2 Answer 2
Question 3 Answer 3
Default vertical
Question 1 Answer 1
Question 2 Answer 2
Question 3 Answer 3
Compact horizontal Question 1 Question 2 Question 3
#1 Answer 1 Answer 2 Answer 3
#2 Answer 1 Answer 2 Answer 3
Compact vertical Question 1
Question 2
Question 3
#1 Answer 1
Answer 2
Answer 3
#2 Answer 1
Answer 2
Answer 3

Preview the result

If you're working with Resco Cloud or Resco Inspections cloud backends, you can preview reports directly in the Questionnaire Designer.

  • Click Report on the toolbar to display the report preview.
  • Click Settings on the toolbar to set the Language of the previewed report, and the data (answers) of the Questionnaire that should be displayed. Use "Virtual" if you want to use empty/default values, or select one of the existing completed questionnaires as a data source.
    Note: Smart default values are ignored when previewing reports.
  • Optionally, for selected questions, you can specify a Preview Answer on the properties pane.

Advanced: Editing questionnaire reports in the Report Designer

The most exhaustive configurator for mobile reports is the Report Designer. If neither the generic automatic report nor the report customized in the Questionnaire Designer is sufficient for your use case, you can set up questionnaire reports in the Report Designer.

Create a report

To take the mobile report definition from a questionnaire template and convert it into a report template that can be configured in the Report Designer, proceed as follows:

  1. Start the Report Designer.
  2. Click New.
  3. As Entity, select "resco_questionnaire".
  4. As Create, select "From Template", then choose the questionnaire to serve as a source for your report.
    Create mobile report for questionnaire entity.png
  5. Set other options on the Create Mobile Report window as needed, then click OK.
  6. Once you're done editing the report, save all changes, and activate the report.

Make new report visible

To make the report available for users in the app:

  • In the Report Designer, make sure that the report is linked to the correct questionnaire. Also, make sure the report is active.
  • In the Questionnaire Designer, open the questionnaire template, click Edit, and choose the right report.
Add report to command.png

Images in questionnaire reports

If you are using the generic report, or if you configure your report in the Questionnaire Designer, image-type questions and answers will be included, no extra effort is needed. However, if you are creating a custom report for a questionnaire from scratch, you need to perform a few extra steps to access the right images related to your questions.

When a questionnaire is saved, the image present on the questionnaire is saved as a record in the note/annotation entity. This entity has two important fields that contain the relationship between the questionnaire and the question where the image is set:

  • Regarding/objectid - contains the reference to the questionnaire
  • Title/subject - contains the reference to the question on which the image is saved
Title and regarding fields.png

Both of these fields are needed to be used in the filter to get the note on the report.

The note entity is used for images if your backend is Resco Cloud or Dynamics. For Salesforce, use the contentversion entity instead. The fields have a different name but the general principle remains the same.

  1. Select the report body and click Edit Sources.
  2. Add a new variable of the type Fetch Result for the annotation entity.
    New annotation variable.png
  3. Define the appropriate filter.
    Filter for the annotation variable.png

Logo in questionnaire reports

Adding the logo of the questionnaire template to a report is even easier than adding an image related to a question. The logo is linked directly from the questionnaire and its title equals "-resco_logo".

  1. Select the report body and click Edit Sources.
  2. Add a variable of the type Fetch Result for the annotation entity.
  3. Define the appropriate filter.
    Questionnaire logo in report.png

Images from repeatable groups

In the case of images that are placed within repeatable groups, you need to adjust the annotation fetch according to the name, index, and repetition of the respective question group. When the question group is repeated on the questionnaire form, the name (field "resco_questiongroup.resco_name") is composed of the name of the question group defined in the questionnaire designer and the index of repetition, e.g. "my-question-group#001". The same works for each question placed within.

First, you need to create a child repeater for question group and add "resco_name" condition to the filer. Use the "Contains" operator and the name string from Questionnaire Designer. This way you make that each repetition will be fetched and used in the report's repeater. A good practice is also to define the sort order so that you get the question groups in the same order as on the questionnaire.

  1. Create a child repeater.
  2. Select the repeater and click Edit Sources, then double-click the filter.
  3. Click Add Condition and enter the condition for "resco_name".
  4. Save all changes.

Next, define the fetch for “resco_question” entity which will get the correct question record. You need this record to fetch the correct annotation record in the following step. The question filter should use “resco_questiongroup” condition for the question group from step 1 and condition based on the question name and index similarly as in the “resco_questiongroup” filter.

  1. Return to the list of variables of the child repeater.
  2. Click Add to add a variable for the entity "resco_question".

The final step is to place an image cell into the repeater and define the "annotation" entity filter. The "annotation.objected" must equal the id of the questionnaire and the "annotation.subject" must equal the name of the image question from step 2.

  1. Close the variables list and return to the questionnaire design.
  2. Select a cell in the child repeater grid and click Add Image.
  3. On the Properties pane, click Binding > Select and define a filter for the annotation.

Images from repeatable groups (variant syntax)

As an alternative, you can use the following binding in a repeater for a group: image#{{resco_questiongroupIndex:000}}.

  • image - name of the question
  • resco_questiongroupIndex - name of the repeater with the suffix 'Index' (for example, use "myrepeaterIndex" for a repeater called "myrepeater") - this inserts the index of the repetition
  • :000 ensures the correct format, e.g., "1" is converted to "001", "2" to "002", etc.
<fetch version="1.0"><entity name="annotation"><filter type="and"><condition attribute="subject" operator="eq" value="image#{{resco_questiongroupIndex:000}}"/>

This syntax is not limited to image-type questions, but it can be used in general for any type of question in a repeater group. Keep in mind that resco_questiongroupIndex corresponds to the "line" of a repeater and not to the index of the repeat group.

Using JSON storage in custom reports

If you want to use a questionnaire component saved in JSON/compressed JSON format on your report, the fetch for this component must include an extra condition.

Filter for json questions.png

Custom reports and versioned templates

When you create a new version of a questionnaire template using the Revise button in the Questionnaire Designer, check Reuse to create also a new version of the report and associate it to the new version.

Revise an older version of the questionnaire.png

The Reuse checkbox applies to custom reports (configured in the Report Designer).

Note If the original version of the questionnaire template did not have an associated report, the new one won't either, even if you select to reuse the report.