Difference between revisions of "Report Designer"

From Resco's Wiki
Jump to: navigation, search
(Running the reports)
(Accessing the designer: also from questionnaire designer)
Line 30: Line 30:
 
#* For Dynamics, go the the '''Settings''' of your CRM and select '''MobileCRM > Inspections'''. Then select '''Designer'''.
 
#* For Dynamics, go the the '''Settings''' of your CRM and select '''MobileCRM > Inspections'''. Then select '''Designer'''.
 
#* 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'''.
 +
 +
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 ==
 
== Using the designer ==

Revision as of 13:28, 10 January 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.

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 dashboard:

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.

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.

Data and queries

Mobile reports contain either text or image data. This data can be static or loaded from the CRM database.

The primary variable for each report is either a single CRM record or a collection of CRM records. You have to decide whether the report is singular when designing the report.

You can also add input variables to the report. These are additional details the user has to fill out before executing a report, for example a range in dates or currency.

Use Fetch and Fetch-Table variables in order to load a record (or records) related to the primary variable. Fetch variable uses standard FetchXml to define the data-filter. Other variables can be also used in place of filter condition values. In case you want to load aggregated and/or group records instead of a record list, you can use the Aggregate function on the Fetch variable.

Variables can define a single primitive value, text, date, or number. However, the primary variable and a fetch variable are composite and contain multiple fields. To address a particular field of a complex variable, we use the . syntax.

Utilizing pre-defined variables you can also effortlessly incorporate several basic details into your mobile reports.

  • 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.

Structure

Mobile Reports are a collection of a few elements:

  • TextBlock and ImageBlock 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).

TextBlock

The purpose of the TextBlock element is to display textual data.

The block size and position are set through the Column, Row, ColumnSpan and RowSpan properties. The parent Grid of the block determines the actual pixel size of the block (assigning width and height to its columns and rows).

Each block has an attached Style, which controls how the text is drawn. It specifies the colors to use, the font name, border color and alignment, and other parameters – see #Edit styles below.

TextBlock displays constant text, which is just a drawn verbatim using the style information. To display dynamic data you must assign a variable binding to the TextBlock. 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).

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. Last but not least, 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}.

ImageBlock

The purpose of the ImageBlock is to display JPEG or PNG images.

Its size and position follow the same rule as the TextBlock.

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.

Grid

The Grid element is the mobile report’s basic container element. It contains TextBlock and/or ImageBlock elements and places them into a table pattern. Each block has grid column, row, column span and row span coordinates (these correspond to logical X, Y, width and height).

The maximum width of the grid is the width of the page, and you can specify the grid column width in either pixels or stars. If the grid contains a star-column, the width of the grid is set to the page width. To calculate the size of a star-column, we start with the remainder width, which is the size of the page minus the size of all pixel-sized columns. The remainder width is then distributed among the star-columns, a 2* column taking twice the space as a 1* (or just *) column.

The row height can be set to Auto for automatic height calculation, or again, as an explicit pixel size. 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).

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

Click Edit Sources to TBD.

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.