Eager to learn more about Resco technology? Take a one-minute survey and help us create better content for you.

Report Designer examples

From Resco's Wiki
Jump to: navigation, 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.
    Image in offline html.png
  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.
    Static image report designer.png
  3. Synchronize the project and verify the result in the app.

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.

Dynamic image report designer.png

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.
    Custom variable in report designer.png
  3. Click On Create and add a rule that performs the multiplication, then close the rules editor and variable editor.
    On create rule report designer.png
  4. Add the field to your report.
    Multiplication in reports.png
  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.
    Add source for repeater.png
  5. Add the following filter, then click Save & Close.
    Filter for repeater.png
  6. Add the following text blocks to your repeater.

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.
    Filter for repeater.png
  3. Add a new variable (myFlag) of the Type Boolean. Select it, click On Create and add the following rule:
    On create rule report designer 2.png
  4. Set the visibility of the text block in the header to depend on the boolean variable.
    Cell visibility in report designer.png
  5. Verify the result in the app. For accounts that have no associated contacts, the header cell should not be displayed in the report.

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.
    Initialize variable 1.png
  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.
    Initialize variable 2.png
  8. Close the rule editor and variables on body level.
  9. Add the the second variable to your report.
    Add count to repeater.png
  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

Signature properties.png

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.
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 comment.png
  • 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.
  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.
    Fetch filter.png
  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.
    Task table variable.png
  3. In the Variables dialog, click Aggregate to define the aggregation properties.
    Configure aggregates.png
    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:
    Fetch table lookup.png
    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.
    Result in the app.png

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 barcodes 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.
    Add fonts to offline html.png
  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.
    Create a new style using the font.png
  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.
    Add the field to the report.png
  4. When you synchronize the app and run the report, you should now see the field printed as a barcode.
    Barcode font in action.png