This is the first part of Workflow Tutorials which will guide you through the initial steps when building a Workflow(s) for the Desktop Applications.
Workflow enables you to configure processes and forms based on XML files. You can work with both flat and geospatially referenced data, control the Desktop App by functions such as manipulating scale level, working with legend items, capturing or editing vector data, etc.
A Workflow basically consists of two XML files - forms definition and workflow definition. In addition, custom JavaScript, CSS files and other resources might be required during the run time. Each tenant instance has its own unique Workflows stored at <Warehouse_Location>\<TENANT_NAME>\Workflows.
Best way to start the Workflow development is to use delivered Workflow Editor that can be launched from the M.App Enterprise Studio. However, for some complex workflow definitions it might be handy to check and work directly with the XML files using your favorite XML editor. It is also suggested to review the generated XML files in order to better understand the whole concept.
Start by importing attached SQL dataset into your database. Microsoft SQL Server spatial data was used during the tutorial preparation. The coordinate system used is EPSG:3857.
You will notice that if you click on some of the rows, you’ll receive information message that the Workflow has ended. That is a result of not having follow-node defined. Let’s add an editing form which will follow clicking on a list element.
Should you encounter an error instead of seeing the expected list, please review the log by checking SECURITY > LOGS in the M.App Enterprise Studio.
Widget Type |
Attribute |
Value |
TextField |
Name |
ID1 |
|
Datatype |
number |
|
Visible |
hidden |
ComboBox |
Name |
RUCR_EXT_D |
|
Label |
Type |
|
Datatype |
string |
|
List of values |
SELECT DISTINCT RUCR_EXT_D FROM Crime |
TextField |
Name |
LOCATION |
|
Label |
Location |
|
Datatype |
string |
DateTimePicker |
Name |
EVT_DATE |
|
Label |
Event Date |
|
Datatype |
datetime |
DateTimePicker |
Name |
RevisionDate |
|
Label |
Date Last Revised |
|
Datatype |
datetime |
|
Editable |
unchecked |
You should end up with a form like this:
Now the form will return to the list after either editing or reviewing is over.
Sometimes it is necessary to have actions available directly for the list views. Let’s add a button that will fit a selected list record. This action button will expect that a defined layer exists in the rich client’s legend.
Attribute |
Value |
Name |
FitCrime |
Label |
Fit |
Action |
SCRIPT[fitCrime({ROW.ID1})] |
As you can see this action requires some custom script function called fitCrime(). Let’s define the custom script file.
function fitCrime(rowId){ SC.Map.setActiveLayer('CrimeWF').done(function(){ SC.Map.setSelectedElements(rowId).done(function(){ SC.Map.fitSelectedElements().done(function(){ SC.Map.setMapScale(2000); }); }); }); }This script will work only within the Desktop App. It sets CrimeWF legend as an active layer, add the related row record to selected elements and lastly, it fits the map, centering the point feature.
Name |
Label |
Filter |
AssaultsFilter |
Assaults Only |
SQL[RURC_EXT_D = 'ASSAULT'] |
VehicleRelatedFilter |
Vehicle Related Only |
SQL[RUCR_EXT_D LIKE '%VEHICLE'] |
Complete workflow files are attached to this article.