Run Reports from Geocortex Workflows

Geocortex Workflow is a licensed product. You can find out about licensing here.

In addition to running reports from Geocortex workflows, you can host and run reports in Web AppBuilder for ArcGIS and the Geocortex Viewer for HTML5. See Host Reports in Web AppBuilder for ArcGIS and Host Reports in the Geocortex Viewer for HTML5.

Geocortex Workflow has a Run Report activity that allows you to run Geocortex reports from workflows. This allows you to integrate report creation with the other business processes that you automate using Geocortex Workflow.

The Run Report activity takes the URL of the report's ArcGIS item as input. When the Run Report activity executes, it passes the URL to Geocortex Reporting to generate the report. The output of the Run Report activity, href, is the URL of the generated report. To allow the user to download the report, you use the href output to display a hyperlink that points to the report.

The Run Report activity has two additional inputs that you can use to parameterize the report—Feature Ids and Parameters. The Feature Ids input is used to pass feature IDs to a layer report. The Parameters input is used to pass other types of values besides feature IDs to the report.

Only workflows are capable of passing additional inputs of various types to reports. Host applications can only pass feature IDs. This is an advantage of using workflows instead of host applications to run reports.

When you configure a workflow to run a report, the report does not need to be hosted by an application. Instead, the workflow is hosted and the workflow controls when the report runs.

Main Steps to Run a Report from a Workflow

  1. In the Report: If you want the report to take inputs, configure report parameters.

    See Pass Values from a Workflow to a Report.

  2. In the Workflow:

    1. Add a Run Report activity to the workflow and configure it to run the desired report, with the desired parameters.
    2. Add a Display Form activity to the workflow and configure it to display a link to the generated report.

    See Configure a Workflow to Run a Report.

  3. In a Host Application: Configure the application to host the workflow.

    See Run Workflows in Web AppBuilder for ArcGIS or Run Workflows in the Geocortex Viewer for HTML5.

Pass Values from a Workflow to a Report

If you want to pass values from a workflow to a report that is run using a Run Report activity, you must configure the workflow to pass the values to the report, and configure the report to receive the values. The way that you configure the workflow and report depends on the types of values you want to pass:

Configure a Report to Take Other Values from a Workflow

To configure a report to take other values besides feature IDs as inputs:

This procedure assumes that you have already created the report.

Step 1: Add a report parameter

  1. Launch Report Designer and open the report.

  2. Click Fields to open the Field List.

  3. Click Parameters to show the management buttons.

  4. Click Add parameter .

    A new report parameter is added.

  5. Click Edit to edit the report parameter.

  6. Configure the report parameter's properties:

    1. In the Name box, type a name for the report parameter.

      The name can include letters, numbers, and underscore characters (_). The name cannot contain spaces or special characters.

    2. If the report parameter represents a single input value, for example a report title, clear the MultiValue checkbox.

      If the report parameter represents multiple values of a particular type, for example, a collection of distances, select the MultiValue checkbox.

    3. Select the type of value from the Type drop-down list.

Step 2: Use the report parameter in the report

The way that you use a report parameter depends on what it represents and your intended use. Report parameters are similar to data fields, in that they both represent run-time values. Like data fields, you can add a report parameter to the report's layout to show its value in the generated report. To do this, drag the report parameter from the Parameters list in the Field List and drop it on the design surface.

You can also combine report parameters with other content in expressions, either by typing the parameter directly into the expression using the syntax [Parameters.ParameterName], or by using the Expression Editor to add the report parameter to the expression.

Formatted report parameter called ReportTitle in a report's layout

Step 3: Repeat for each input value

  1. Repeat steps 1 and 2 for each input value that is not a feature ID.

Configure a Workflow to Run a Report

To configure a workflow to run a report:

Step 1: Add a Run Report activity to the workflow

  1. In Workflow Designer, open the workflow that you want to run the report.

  2. Drag a Run Report activity to the desired location in the flowchart and connect it.

  3. Url: Configure the Run Report activity's Url input:

    1. In Report Designer, open the report that you want to run.

    2. Click Info to open the Info panel.

    3. Copy the URL for the report's ArcGIS item.

    4. In Workflow Designer, select the Run Report activity on the design surface to show the activity's properties.

    5. Paste the URL into the Url box.

  4. Feature Ids: If the report is a layer report, specify the collection of feature IDs in the Run Report activity's Feature Ids input.

    The way that you specify the collection depends on how you created the collection in the workflow. For example, you could query the layer for the IDs of the features that you want to include in the report and then use a Get Feature Set Object IDs activity to create a collection of the feature IDs to use as the Run Report activity's FeatureIds input. For testing purposes, you may want to specify a collection of known feature IDs, for example: =[ 5238, 5239, 5240 ]

  5. Parameters: If the report expects additional inputs to be passed to it, specify a collection of additional inputs in Parameters.

    The way that you specify the collection depends on how the collection was created in the workflow. You can specify the collection using syntax similar to this:

    ={ parameter1: "string literal", parameter2: 123456, parameter3: $form1.state.textBox1.value, parameter4: $distance1.distance }

    The names of the parameters that you specify in the Parameters input must match the names of the report parameters configured in the report, including capitalization. For example, if the report parameters are called RequestedBy, Maximum, and ReportTitle, then you could set the Parameters input to ={ RequestedBy: "Admin", Maximum: 20, ReportTitle: $form1.state.textBox1.value }.

Step 2: Add a Display Form activity to the workflow

  1. In Workflow Designer, drag a Display Form activity to the flowchart and connect it.

  2. Double-click the Display Form activity to edit it.

  3. Select Form Title in the form preview to show the Header element's properties and type a Title for the form.

  4. Add a Text element to the form.

  5. Expand the Text element's Events and add a load event.

    The load subworkflow opens.

  6. Drag a Set Form Element Property activity to the design surface and connect it.

  7. Select the Set Form Element Property activity on the design surface and set the Property Value input to: =`[Open Report](${$runReport1.href})`

    If the Run Report activity's ID is not runReport1 in your workflow, replace runReport1 in the expression with the actual ID.

    The Property Value defines an Open Report hyperlink that points to the report. Here's how:

  8. Either leave the Markdown input blank or set it to true.

    The Markdown input indicates whether Markdown has been used in the Property Value input. In this case, Markdown is used to create the hyperlink, so the Markdown input must evaluate to true. The Markdown input is true by default.

Step 3: Test the workflow

  1. Press Ctrl+S to save the workflow.

  2. Run the workflow in the Sandbox.

    To run a workflow in the Sandbox, click Info in the sidebar, click Run in Sandbox, select the environment, and then click Run Workflow. You can press F12 at any time to see the verbose log.

    The Run Report activity will generate the report and the Display Form activity will display the link that the user clicks to open the report.

  3. If you haven't yet configured a host application to host the workflow, follow the instructions for the desired host application: Run Workflows in Web AppBuilder for ArcGIS or Run Workflows in the Geocortex Viewer for HTML5.

  4. Run the workflow in the host application.

© 2019 Latitude Geographics Group Ltd. All Rights Reserved.

Documentation Version 5.2