Skip to content

vertigis/workflow-activities-configurable-queries

Repository files navigation

CI/CD npm

This project contains activities for generating and executing configurable queries. A configurable query workflow is comprised of a dynamically generated form and dynamically generated where clause to be applied to an ArcGIS Feature Query. Queries are configured using a collection of SearchFields, which define the field, form element and operation to be applied to a Feature Layer query. The project also includes a complete Workflow implementation.

Requirements

VertiGIS Studio Workflow Versions

These activities are designed to work with VertiGIS Studio Workflow versions 5.30.1 and above.

Usage

To use these activities in VertiGIS Studio Workflow Designer you need to register an activity pack and then add the activities to a workflow.

Register the Configurable Queries activity pack

  1. Sign in to ArcGIS Online or Portal for ArcGIS
  2. Go to My Content
  3. Select Add Item > An application
  4. Reload VertiGIS Studio Workflow Designer
  5. These activities will now appear in the activity toolbox in a Configurable Queries category

Search Field

The Add Query Elements activity accepts an array of Search Field JSON objects as an input. The SearchFields.json file provides an example.

Search Field Schema

{
  /* The name of layer field to search (Required) */
  field: string,
  /* The SQL operator to apply to the field (=, !=, <, >, >=, <=, IN, and BETWEEN) (Required) */
  operator: string,
  /* The name of the field to use as the parent in a cascading relationship. (Optional)*/
  dependsOn: string,
  /* The form element type to use for the search. (Required) */
  type: "AutoComplete" |
        "CheckBox" |
        "CheckGroup" |
        "DatePicker" |
        "DateRangePicker" |
        "DateTimePicker" |
        "DropDownList" |
        "ItemPicker" |
        "ListBox" |
        "Number" |
        "NumberRangeSlider" |
        "NumberSlider" |
        "RadioGroup" |
        "TextArea" |
        "TextBox" |
        "TimePicker",
    
  /* The title to appear for the search element. (Required) */
  title: string,
  /* The description to appear for the search element. (Optional) */
  description: string,
  /* The default value of the search field.  Only applies when cascade is false.  (Optional) */
  value : defs.Value,
  /* The events to be used for the element. If cascade is set to true then a 'populate' event must be set.  If the type is Autocomplete then the
     suggest event must be set.  (Optional) */
  events: {
    changed: string | undefined,
    clicked: string | undefined,
    populate: string | undefined,
    suggest: string | undefined,
    validate: string | undefined,
  },
  /* A form element JSON object.  This is useful when finer grained control over the form is required. (Optional) */
  element: defs.Element
}

Configured Query Workflow

The Configured Query Workflow is a full implementation of a configurable query form. It can be used as-is, run as a SubWorkflow from another Workflow or modified to meet your needs.

Usage

To use the Configured Query Workflow, download the content.json to your local machine and import it into your Portal using VertiGIS Studio Workflow designer.

Workflow Inputs:
  • layerId (Required): The layer Id for the layer to run the stored query against. Supported layer types include FeatureLayer, SubtypeGroupLayer, SubtypeSubLayer and MapImageLayer.
  • sublayerId (Optional): The sublayer to query from a MapImageLayer.
  • formTitle (Required): The title to appear in the form.
  • formDescription (Optional): The description text to appear with the form's title.
  • searchFields (Required): An array of SearchField objects.
  • eventSubWorkflow (Optional): The Url to a subworkflow to be executed when a form event is fired. The SearchFields, event type, event data and form state are passed to the subworkflow.
Workflow Outputs:
  • action: The form action.
  • formState: The state of the form.
  • queryResults: The results of the configured query if the workflow was not cancelled.

Select Query Workflow

The Select Query Workflow presents the user with a list of queries to execute and runs the Configured Query Workflow in a Run Workflow activity.

Usage

To use the Select Query Workflow, download the content.json to your local machine and import it into your Portal using VertiGIS Studio Workflow designer.

Workflow Inputs:
  • formWorkflow (Required): The Url to the Configured Query Workflow
  • inputModel: An array of json objects that include the inputs for the Configured Query Workflow. See the Input Model for an example of how to configure this parameter.
  • eventSubWorkflow (Optional): The Url to a subworkflow to be executed when a form event is fired. The SearchFields, event type, event data and form state are passed to the subworkflow.

Development

This project was bootstrapped with the VertiGIS Studio Workflow SDK. Before you can use your activity pack in the VertiGIS Studio Workflow Designer, you will need to register the activity pack.

Available Scripts

Inside the newly created project, you can run some built-in commands:

npm run generate

Interactively generate a new activity or form element.

npm start

Runs the project in development mode. Your activity pack will be available at http://localhost:5000/main.js. The HTTPS certificate of the development server is a self-signed certificate that web browsers will warn about. To work around this open https://localhost:5000/main.js in a web browser and allow the invalid certificate as an exception. For creating a locally-trusted HTTPS certificate see the Configuring a HTTPS Certificate section on the VertiGIS Studio Developer Center.

npm run build

Builds the activity pack for production to the build folder. It optimizes the build for the best performance.

Your custom activity pack is now ready to be deployed!

See the section about deployment in the VertiGIS Studio Developer Center for more information.

Documentation

Find further documentation on the SDK on the VertiGIS Studio Developer Center