1

Report Designer examples

From Resco's Wiki
Jump to navigation Jump to search
Mobile reports

This article describes several useful examples of using the Report Designer. If you are looking for examples specific for questionnaire reports, see Mobile reports for Resco Inspections.

Static image

Use static images for images that should not depend on the record(s) selected for the report. For example, you can add your company logo to the header block.

  1. Edit your app project in Woodford, select Offline HTML from the Project menu, and upload your static image. In this example, we create a Reports folder and add the file image01.png. Publish your project.
    Report designer examples: Static image (add image to offline html directory)
  2. In Report Designer, select a cell in the header block and click Add Image. Set Binding Type to Constant. As Binding, enter the path to your image. In our example Reports\image01.png.
    Report designer examples: Static image (add image to report)
  3. Synchronize the project and verify the result in the app.
Note Content stored in Woodford is only available if you are using Resco Mobile CRM for generating the report. For example, such images are not available if you are using Resco Reports connector.

Dynamic image

Use dynamic images that depend on the record selected for the report. For example, consider a report for a single contact where you want to include that person's photo. The image is stored in the Annotation (Note) entity. The ID of the image points to the ID of the Contact. Ensure that the title (subject) of the image, for example, "ListImage", is unique.

Report designer examples: Dynamic image (add image - edit filter)

We recommend that you add a Media tab to the form of the entity, where you can define the title (subject) of the note with the specific image/signature. This approach also ensures that there will only be one image with that note title.

Multiply values

There are situations where you don't want to display two fields directly, but you want to perform an arithmetic operation and display the result. In the following unlikely example, we multiply the latitude and the longitude fields of your accounts and display the product in the report.

  1. Select the Body element of your report and click Edit Sources.
  2. Click Add to add a custom variable that stores the result of the multiplication. Enter a name and type, then click OK.
    Report designer examples: Multiply values 1 (create custom variable)
  3. Click On Create and add a rule that performs the multiplication, then close the rules editor and variable editor.
    Report designer examples: Multiply values 2 (on create rule)
  4. Add the field to your report.
    Report designer examples: Multiply values 3 (add custom variable to report)
  5. Verify the result in the app.

Cell visibility

You can control the visibility of a text block or image block by setting the Visible property.

In the following example, we list all contacts related to an account in a repeater block. We're using the Visible property to hide the text block in the header section of the repeater if an account has no associated contacts.

Create the repeater

  1. Edit the report for your account.
  2. Select the body of your report and click Add Repeater.
  3. Select the repeater, move it to the appropriate location of your report and click Edit Sources.
  4. Select the Item and click Edit. Change the Entity to contact and click OK.
    Report designer examples: Create the repeater 1 (Add source for repeater)
  5. Add the following filter, then click Save & Close.
    Report designer examples: Create the repeater 2 (Filter for repeater)
  6. Add the following text blocks to your repeater.
    Report designer examples: Create the repeater 3 (add repeater to the report)

Manage visibility

  1. Select the body of your report and click Edit Sources.
  2. Add a new variable (myContact) of the Type Fetch Result for the Entity contact. Select it, click Edit, and add the same filter as above.
    Report designer examples: Manage visibility 1 (Filter for repeater)
  3. Add a new variable (myFlag) of the Type Boolean. Select it, click On Create and add the following rule:
    Report designer examples: Manage visibility 2 (On create rule)
  4. Set the visibility of the text block in the header to depend on the boolean variable.
    Report designer examples: Manage visibility 3 (Cell visibility)
  5. Verify the result in the app. For accounts that have no associated contacts, the header cell should not be displayed in the report.
Tip If you need to achieve the opposite behavior, use an exclamation mark ("!") in front of the variable, e.g., {!myFlag}

Automatic numbering of repeating blocks

In this example, we want to number the repeater blocks displayed in a report.

  1. Select the body of your report and click Edit Sources.
  2. Click Add and create a new decimal variable (count).
  3. Click On Create and initialize this variable to 1.
    Report designer examples: Automatic numbering of repeating blocks 1 (Initialize variable)
  4. Close the rule editor and variables on body level.
  5. Select the repeater and click Edit Sources.
  6. Click Add and create a new decimal variable (count2).
  7. Click On Create and add the following steps.
    Report designer examples: Automatic numbering of repeating blocks 2 (Initialize variable 2)
  8. Close the rule editor and variables on body level.
  9. Add the the second variable to your report.
    Report designer examples: Automatic numbering of repeating blocks 3 (Add count to repeater)
  10. Verify the result in the app.

Adding signatures to reports

Report Designer offers several ways of adding signatures to reports.

  • On some reports, it is sufficient to use a static signature. In these cases, consider saving the signature as an image to the Offline HTML and then add the image to the report using Report Designer. See the section for static images above.
  • Alternatively, you may want to save the signature image as a note, related to a record. For this scenario, you can study the section for dynamic images, or read our blog. Blog
  • Resco Mobile CRM can be integrated with a third-party solution from DocuSign. See how to Add legally-binding digital signatures. Blog
  • With the most recent addition to Report Designer, you can designate a place on your report, where you can add signature(s) and comment(s) at run time. This approach allows you, for example, to generate a report that the customer can view on your device, then sign it, and optionally add some comments. Once saved, the signature and comments are added to the report. This scenario is described below.

Signing reports at run time

Report designer examples: Signing reports at run time (signature properties)

Report Designer can be configured to use enhanced signature workflow which allows signing generated reports directly in the app.

Adding a signature
  1. Edit a report.
  2. Select an appropriate location on the grid, then click Add Signature.
  3. Configure the signature on the Properties pane:
    • Check Enhanced signature to enable the workflow that allows you to sign a generated report.
    • Use Binding to set the label of the signature on the report. If your Binding Type is a constant, enter text directly; if your Binding Type is a value, you can link to a record field.
    • In the Signature storage field, select the entity where the captured signature image should be stored. In the Label field, select the file name prefix for the image.
    • In the Report entity field, select the entity used for the report.
    • In the Comment field field, select the entity field where the signature comment should be saved. See also the notes about the signature comments below.
    • If you want the signature not to stay saved in the database, enable Discard signature after report is saved. The signature becomes part of the report but isn't saved elsewhere. This can be mandatory for legal reasons in some countries, and it can also save you database storage. However, the signer must sign the document anew if you need to regenerate the report.
Multiple signatures
  • You can add multiple signatures to one report.
  • Make sure to use a distinct name for each of the captured signature images.
  • Also, use a distinct field name for each comment.
Signature comments
  • Each person signing the report can also add a comment to the report.
  • The comment is saved to a field defined in the properties of your signature, in the field Comment field. Leave the field empty if you don't want to allow comments.
  • This must be a Single Line of Text or Multiple Line of Text type of parameter. The field must also be enabled in the Woodford project. App users must have permission to read, create, and update the field.
Report designer examples: Signature comments (report comment)
  • This comment is not displayed on the report automatically, you have to place it, just like a regular text field, using the Add Cell button.
See also YouTube
Warning Known issue: On Android devices, an enhanced signature is saved correctly, however, is not properly displayed in the app. To see the signature correctly, select Open from the hamburger menu to open the document in an external PDF viewer (if available on the device).

Add N:N entity to a report

If you have entities linked by an N:N relationship, you can access them in a repeater. In this example, we have the entities Competitor and Opportunity linked by an N:N entity Opportunitycompetitors. The procedure below explains how to add a list of related opportunities to the report for competitors.

  1. Edit the report.
  2. Add a simple repeater (not a child repeater).
  3. Select the repeater and click Edit Sources.
    Report designer examples: Add N:N entity to a report (create variable)
  4. Select the "Item" and click Edit.
  5. On the Select Entity screen, select the "opportunity" entity, then click OK.
  6. Define the fetch filter using a linked N:N relational entity and the ID of the base record.
    Report designer examples: Add N:N entity to a report (fetch filter)
  7. Click Save & Close twice to return to the report.
  8. Notice that the fields pane on the left now includes fields of the opportunity. You can now use the fields in your report.

Counting the tasks

In this example, we have a report for a single account. The report also includes a list of contacts, and for each contact, the number of tasks.

Creating the contact list is straightforward: Just add a child repeater to the report.

Displaying the number of tasks is a bit more tricky: There are actually two ways how to handle this.

Brute force

  1. Add a Fetch variable in the repeater sources.
  2. Use Set Variable to select only the tasks for the particular contact.
  3. Use Aggregates to calculate the count.

Because the aggregate is calculated for every contact separately, this report might produce a high load on the server, and, depending on the number of contacts, it can be slow.

Use Fetch Table variable

  1. Select the body of your report and click Edit Sources.
  2. Define the variable TaskTable. Use regid as the table key.
    Report designer examples: Use Fetch Table variable 1 (Task table variable)
  3. In the Variables dialog, click Aggregate to define the aggregation properties.
    Report designer examples: Use Fetch Table variable 2 (Configure aggregates)
    The result of the query is a simple table, with the RegardingObjectId of each task and the number of times the same RegardingObjectId was encountered. In other words, we grouped the tasks by the RegardingObjectId and calculated the size of each group.
  4. To access the table, define a Fetch Table Lookup variable, however, this time on the repeater level:
    Report designer examples: Use Fetch Table variable 3 (Fetch table lookup)
    The result is an object with both the regid and taskcount properties. This is useful if the Fetch Table has more aggregates (e.g., you want to calculate not only the count but also sum and averages).
  5. Add the field TasksPerContact.taskcount to your report.
  6. Verify the result in the app.
    Report designer examples: Use Fetch Table variable 4 (Result in the app)

Custom fonts

You can add custom fonts to your reports. In this example, we use a custom barcode font to display product numbers as a barcode on a report.

  1. Add the font to your Offline HTML folder:
    Using Woodford, edit an app project, select Offline HTML from the Project menu, and upload the new font to any folder. Save and publish the app project.
    Report designer examples: Custom fonts 1 (Add fonts to offline html)
  2. Define a new style that uses the font:
    Using Report Designer, edit the report, click Edit Styles to open the style editor, click Add to create a new style. Save the style and return to the report.
    Report designer examples: Custom fonts 2 (Create a new style using the font)
  3. Add the barcode field to the report:
    Using Report Designer, edit the report to add a new field. As the Binding, use the format *{entity.fieldname}*, and select the appropriate style. Save the report.
    The syntax with asterisks as start/stop characters applies to Code39 barcode format. Other formats may use different delimiters.
    Report designer examples: Custom fonts 3 (Add the field to the report)
  4. When you synchronize the app and run the report, you should now see the field printed as a barcode.
    Report designer examples: Custom fonts 4 (Barcode font in action)
Note Various barcode standards use start codes, stop codes, and/or checksum to ensure the code isn't tampered with. Resco reports do not include this function out of the box; you must calculate any necessary checksum manually and include them in the barcode to make the barcode compatible with standard barcode scanners.

Conditional formatting with more than two styles

This example explains how to apply a custom style (color background) to a cell depending on its value. We have a list of related contacts on an account report and we want to apply different colors to the contact names based on the value of their city.

Report designer examples: Conditional formatting with more than two styles (overview)

  1. Define the necessary styles. If you decide to modify the background color of a cell as we do in this example, remember to disable transparency.
    Report designer examples: Conditional formatting with more than two style 1 (Defining a style with green cell background in report designer)
  2. Define new boolean variables that will control the visibility of the right color. In our example, we have one field (contact.name) that we want to highlight with one of the three styles, i.e., we need 3 variables.
    Report designer examples: Conditional formatting with more than two style 2 (Variables for color styles)
    • Select the repeater that includes the field you want to highlight (or report body) and click Edit Sources.
    • Click Add to add the three new variables (type: Boolean).
  3. Select the variable at the bottom (in our example, UseNormal) and click On Create.
  4. Enter a rule with business logic that controls which colors to use.
    Report designer examples: Conditional formatting with more than two style 3 (Rule that controls which colors to use)
  5. Save all changes in the rules and variables editor and return to the report structure.
  6. Add new rows to the repeater grid. Drag contact.name to the grid 3 times. For each, select the Style. As Visible, enter the matching variable.
    Report designer examples: Conditional formatting with more than two style 4 (Add multiple rows with contact name and apply style to each)
  7. As the final step, place all three contact.name fields to the same cell. One of the ways of doing this is to set Column, Row, Columns, and Rows to the same values for all fields. The fields will be on top of each other, but thanks to the rule, only one of them will be visible.






Was this information helpful? How can we improve?