Difference between revisions of "Report Designer"

From Resco's Wiki
Jump to: navigation, search
(Accessing the designer)
Line 31: Line 31:
 
# Launch the designer:
 
# Launch the designer:
 
#* For [[Resco CRM server]], [[Resco_CRM_server#Logging_in|log in to your organization]] and select '''Reports'''.
 
#* For [[Resco CRM server]], [[Resco_CRM_server#Logging_in|log in to your organization]] and select '''Reports'''.
#* For Dynamics, go to the '''Settings''' of your CRM and select '''MobileCRM > Inspections'''. Then select '''Designer'''.
+
#* For Dynamics, go to the '''Settings''' of your CRM and select '''MobileCRM > Mobile Reports'''. Then select '''Mobile Reports'''.
 
#* For Salesforce, log in to [[Resco for Salesforce]] and select '''Mobile Report Editor'''.
 
#* For Salesforce, log in to [[Resco for Salesforce]] and select '''Mobile Report Editor'''.
  

Revision as of 07:58, 7 April 2020

Report Designer is a tool available to CRM administrators that allows you to design custom document templates. The template is then saved in your CRM as a record and it can be used across all mobile projects in your organization.

If you don't want to use the designer, you can create or edit the report templates directly as XML files.

Tip This article introduces the concepts and basic functions of the Report Designer. To jump into action, check out also the Report Designer examples.

Mobile reports

Reports are read-only visual representations of entity data. Users of the mobile app can use the templates to create reports on the go, using data from CRM. Reports are generated directly in the Mobile CRM application, even in offline mode, so there is no need for any connection to the internet or CRM server. This allows you to create e.g. an invoice or a service report at the customer and save it to a CRM record as an attachment. Or instantly email it to your customers and partners. Or use a wireless printer to directly print it.

Documents can be generated in Word (.docx), Excel (.xlsx), PDF, or HTML formats. It is also possible to use one or more records as a source for the report.

Mobile reports support many popular building blocks, such as

  • Header and footer sections that repeat on all pages of the document
  • Repeating blocks for recurring items (such as invoiced products)
  • Any field from your entities
  • Images, both static (for example your company logo) and dynamic (for example a signature)
  • Dynamic reports involving business logic, for example, calculations, show or hide sections under specific conditions, etc.

See also the followings blogs: Blog

Accessing the designer

Report Designer can be started from the management console of your CRM:

  1. Using a web browser, log in to your CRM.
  2. Launch the designer:

In the case of Resco Inspections, you can start the Report Designer directly from the Questionnaire Designer: Click Mobile Report while editing a template; this button takes you directly to the report for this questionnaire.

Using the designer

On start, the Report Designer shows a list of existing reports. Use the toolbar in the top part of the screen to access most functions.

New
Create a new report. Specify a name, select an entity, the language, and decide if you want a report for a single record, for multiple records, or a combination.
Edit
Select an existing report and open it for editing.
Properties
Select a report and modify its properties.
Delete
Delete selected report.
Activate
Active reports are available in the app.
Deactivate
Inactive reports are not available in the app.
Import
Upload an XML file with a report.
Export
Download a copy of the select report template to your computer as a file in XML format.
Clone
Create a duplicate of the selected report template.

You can use the Search field above the toolbar to filter your reports. To sort the reports, click the header row of the report list.

Editing a report template

A new report contains a header block, a footer block, and a grid block.

  • Use the toolbar buttons to add or remove grids, cells, columns, repeating blocks, and images / signature.
  • Left pane displays a list of fields of the selected entity. Drag fields to the report.
  • Use the right pane to modify the properties of selected items.

Once you've done editing a report, save changes and remember to activate it to make it available in the app.

Structure

Mobile reports are a collection of a few elements:

  • Text blocks and image blocks define the data to display.
  • The Grid element is used to arrange the blocks.
  • The Repeater element allows iterating over a collection of CRM records (contained in the primary variable or fetch variables).

Grid

Grid is the basic container element of a mobile report. It contains blocks of text and/or images arranged into a table pattern.

Click Add Grid to place a new grid. Grids can be added to the top level of your report, or into a Repeater element. New grids are added at the end of their parent element, use the buttons Up and Down to move them around.

Each grid starts with a single empty cell. Select the grid and click Add Column and Add Row to increase the number of columns and rows of your grid.

Grid in report designer.png

Column width

The maximum width of the grid is equal to the width of the page. You can specify the width of each column on the Properties pane in the Columns parameter, either a fixed width (in pixels) or flexible width (using stars notation). Separate values for each column with a semicolon.

If the grid contains at least one column with flexible width, the width of the grid is set to the page width. To calculate the width of flexible columns, we subtract all fixed-width columns from the page width and distribute the remainder evenly. To increase the width of a flexible column, add a number before the star; a 2* column is twice as wide as a 1* column.

In the example above, the first column is 100 pixels wide, and the remaining space is divided to column 2 and column 3, with column 3 being twice as wide as column 2.

Row height

The height of each row is specified in the Rows parameter on the Properties pane. Use Auto for automatic height calculation, or enter an explicit pixel size. Separate values for each row with a semicolon.

The automatic calculation uses the maximal height of the blocks in the grid row. That means either the height of text in a particular font or the height of an image (the image height might be scaled automatically to fit into a particular width).

In the example above, the first row is exactly 100 pixels tall, the remaining two rows use flexible height to match their content.

Header and footer

Header and footer elements are essentially very similar to grids, with the following exceptions:

  • They repeat on each page of the report
  • They cannot be deleted from the report (but they can be empty)

Text block

The purpose of the text block is to display textual data. This can be either data from your organization or simply static text.

Click Add Cell to add a text block to your report. A text block can be placed into any grid, or into the header or footer.

You can configure the behavior of your text block on the Properties pane.

  • Column and Row define the position of the block in the grid (starting with 0, 0 for the top left corner).
  • Columns and Rows define the spanning of the block across multiple columns or rows. Default values: 1. The actual pixel size of a text block depends on the properties of the grid.
  • Style and Visible control if and how the text is displayed
  • Binding Type defines how the Binding should be interpreted:
    • Constant is used to display text verbatim, for example for labels.
    • Raw Value and Value are used to display dynamic data.

Dynamic data

Drag a field from the left pane directly to the text cell. This binding can be the name of a primitive (input) variable, such as dateRange. It can also be the name of a composite (primary, fetch) variable and a particular field, for example: order.totalamount.

In order to display multiple variables in a single field, wrap their names in curly brackets: {order.street1}, {order.city}, {order.country}. Any text outside of brackets will be copied verbatim (as a constant).

Formatting

If you need to format a numeric or date value in a certain way, add a colon and a formatting string after the variable name: {order.createdon:YYYY-MM-DD}. Please see the C# Visual Studio reference for the possible formats.

You can optionally include also the culture identifier to format dates or numbers for a specific culture. This controls the names of months, separators, etc.: {order.createdon:YYYY-MM-DD;en-US}. Examples:

  • To convert the decimal variable to currency, use this C# format in the binding field – {variableName:C}.
  • To convert DateTime variable to date variable, use this C# format in the binding field – {variableName:MMMM d yyyy}.

Image block

The purpose of image blocks is to display JPEG or PNG images. Their size and position follow the same rule as the text block. Click Add Image to add it into any grid, header, or footer.

Static images are loaded from the Offline HTML section. You need to specify the image path: folder/name.png or folder/name.jpg.

Dynamic images are loaded from note attachment or cloud documents. To select an image, you simply define a fetch filter for the note entity. Remember that you can use also other variables in place of filter condition values.

See also Report Designer examples.

Signatures

We offer multiple ways how to display signatures on your reports. Click Add Signature to add a signature block into your grid, header, or footer.

See Adding signatures to reports for more information.

Repeater

Thanks to the Repeater element, you can display a list of multiple records in your reports. The element consists of an optional header Grid element and a body. If the repeater spans multiple pages, the header will be repeated on each page. The body of the repeater may contain a single or multiple Grid elements. You can also nest one or several Repeater elements into the report.

The repeater inherits all variables defined for the report.

It also contains one special iteration fetch variable. The repeater body is rendered for every record from this query.

Visibility

You can control the visibility of a TextBlock, ImageBlock and Grid, by setting the visibility property. The value used must be a valid variable in curly braces, e.g. {customer.primarycontactid}. The block or grid will not be visible only if the variable is false, zero (0) or null (empty). If you need the opposite behavior, use the exclamation mark before the variable: !{customer.primarycontactid}.

Editing styles

Click Edit Styles while editing a report template to customize cell styles. Unlike styles in Woodford where the styles are shared across an entire app project, styles in the Report Designer are unique per report.

See Style editor for more information.

Edit sources

Mobile reports contain text, numbers, and images. This data can be static or loaded from the database. When you're creating a report, you must decide about the primary variable of your report: either a single record or a collection of records. However, sometimes you might need additional variables in your report.

Click Edit Sources to define the additional variables:

  • Primitive variables: string, decimal number, boolean, date and time
  • Complex variables: fetch result, fetch table, fetch table lookup

Once defined, the variables are listed in the left pane, along with primary variables. Drag them to the report as needed.

Variables can be defined on the root level or repeater level. Root variables can be used in the entire report; variables defined on the repeater level are only available for use in that repeater.

Primitive variables

The simplest use case is reuse. For example, if you need to use the same static text or number on several locations of your report, you can define an appropriate variable and add it to the report multiple times as needed. If you later need to update this value, you simply change it once in the variable definition.

Variables can be used to perform arithmetic or string operations. See an example how to use variables to multiply data and display them in your report.

For a repeater block, you can use variables, for example, to number the individual instances of the repeater. See automatic numbering for inspiration.

Complex variables

Complex variables involve FetchXML to retrieve additional data for your report. Often, you need to display data from a related entity; for example, on an Account report, you might want to display related contacts.

You have to define a data filter to get the records that you need. In the filters, you can use other variables in place of filter condition values.

Another aspect of complex variables is that they are not a single value, but often an array of multiple values. We use the dot notation to access the values, for example, myContact.name.

Built-in variables

Report Designer also comes with a few built-in variables, predefined for your convenience.

  • The PageNumber variable (Page: {PageNumber}) specifies the sequence order of each page.
  • The PageCount defines the total number of pages that the report contains.
  • The CurrentDate variable ({CurrentDate:DDDD}) enables you to add the date and exact time when the mobile report was generated.

For example, in the footer (or elsewhere on the page) you could include {PageNumber}/{PageCount}, dynamically changing depending on the page the user is viewing at that moment.

Running the reports

You can run the reports in the app, in various components:

  • On a form, a report can be configured via Form commands. Users can access the report using the hamburger menu in the top right corner of the form.
  • On a view, a report can be configured using the Multi Select function. Users can select multiple records and then select the action from the bottom right corner.
  • On a questionnaire, a report can be configured using the Mobile Report button in the Questionnaire Designer, or using Commands. Users can launch the report for completed questionnaires. It is also possible to configure an automatic generation of reports on completion, or allow users to manually run a preliminary report for an in-progress questionnaire.