Integrated Workflows in GeoMedia Smart Client

From GeoMedia Smart Client
Jump to: navigation, search




This chapter describes how to use workflows as integrated workflows in GeoMedia Smart Client.

General

To access a workflow from Smart Client, you have to define a browse workflow action (see: [1] and a connection (see: [2])) for the workflow in the Smart Client Administrator. The form of the workflow needs a FormGeometry attribute that defines the geometry column name, the Smart Client layer name (or the feature identifier), and the actions that have to be available when editing is activated in Smart Client.

To start editing in Smart Client, a FormAction has to be defined with action="SCRIPT[IG.captureGeometry()]". On executing this action, the current values of the item are stored in the session, and the workflow will be closed in order to be able to start editing in Smart Client. Saving the geometry in Smart Client starts the workflow again, the attributes from the item are stored in the session, and the edited geometry/geometries will be merged and persisted in the database. Each geometry gets the same attributes assigned. After saving the data, the workflow proceeds (see: [3]).



How does it work

If an item in Smart Client is selected and the workflow is started, the system checks whether the workflow connection and the connection of the active feature are equal and, if so, the identifier value is stored in the session. If the table attribute of the form and the the entity of the active feature match, the selected item will be displayed.



Workflow: FormSettings

FormGeometry:

Each form that interacts with the Smart Client needs a FormGeometry element. The name of the FormGeometry defines the geometry column name of the current entity, and the layer defines the feature name or the featureId of the feature that should be edited. Furthermore, you have to define which actions should be available in case that it is a new entry or the geometry is null (NewActions) and which actions should be available in case of an existing entry (EditActions). The system sets the according actions. More then one action can be defined for each element by using a comma to separate them. If isstartonload is set to true, this action will be activated by default. Example:

  1.  <FormGeometry name="GEOMETRYCOLUMNNAME" layer="ENTITY_NAME of the feature">
  2.   <NewActions>
  3.      <GeometryAction name="GE_NEWPOLYGON" isstartonload="true" />
  4.      <GeometryAction name="GE_NEWPOLYLINE" />
  5.   </NewActions>
  6.   <EditActions>
  7.      <GeometryAction name="GE_MODIFY" isstartonload="true" />
  8.   </EditActions>
  9.  </FormGeometry>



Available Actions:

 "GE_NEWPOINT", 
 "GE_NEWTEXT", 
 "GE_NEWPOLYLINE", 
 "GE_NEWPOLYGON", 
 "GE_NEWRECTANGLE", 
 "GE_MODIFY", 
 "GE_ROTATE", 
 "GE_TEXTCHANGE", 
 "GE_SUBSTRACT", 
 "GE_MERGE", 
 "GE_DELETECOLLECTIONPART", 
 "GE_SPLITPOLYGON", 
 "GE_SPLITPOLYLINE", 
 "GE_MERGEPOLYLINES", 
 "GE_ADDPOINTTOCOLLECTION", 
 "GE_MOVE", 
 "GE_DELETE"
 "GE_ADOPT"

FormAction:

To start editing in Smart Client, a FormAction has to be defined in the form. The action attribute of the FormAction has to be set to "SCRIPT[IG.captureGeometry()]". Example:

<FormAction name="EditGeometry" label="Save" action="SCRIPT[IG.captureGeometry()]" />



Pfeil new.png To the top Pfeil new.png

Script Actions to interact directly with Smart Client

It is possible to interact directly with Smart Client using JavaScript calls, which may be chained and which may also be used in custom scripts. Below is the list of JavaScript actions to interact with Smart Client (to be continued).
All Script Actions are available since GMSC 2013 unless otherwise noted.

Script Action Description
IG.setActiveFeature(activeFeature) Sets the active feature in Smart Client. The active feature may be set using the name or the ID of the feature.
 <FormAction name="SetActiveFeature" label="Set active feature" 
action="SCRIPT[IG.setActiveFeature('Building Extension')]" />
IG.clearActiveFeature() If Smart Client has an active feature set, this call deactivates the active feature.
 <FormAction name="ClearActiveFeature" label="Clear active feature" 
action="SCRIPT[IG.clearActiveFeature()]" />
IG.getActiveFeature() If Smart Client has an active feature set, this call gets the active feature from Smart Client.
 <FormAction name="GetActiveFeature" label="Get active feature" 
action="SCRIPT[IG.getActiveFeature()]" />
IG.setMapScale(scale) Sets the current scale in Smart Client.
 <FormAction name="SetMapScale" label="Set scale" 
action="SCRIPT[IG.setMapScale(1000)]" />
IG.getMapScale() Gets the current scale from Smart Client.
 <FormField name="MapScale" label="Scale" type="textfield" datatype="string" persisted="false" 
defaultvalue="SCRIPT[IG.getMapScale)]" />
IG.setMapCenter(centerX, centerY) Sets the current map center in Smart Client.
 <FormAction name="SetMapCenter" label="Set map center" 
action="SCRIPT[IG.setMapCenter({FORM.X},{FORM.Y})]" />
IG.setSelectedElements(toSelect) Sets the selected elements in Smart Client.
 <FormAction name="SetSelectedElements" label="Set elements" 
action="SCRIPT[IG.setSelectedElements({FORM.ID})]" />
IG.fitSelectedElements() Forces Smart Client to fit to the selected elements.
 <FormAction name="FitSelectedElements" label="Fit elements" 
action="SCRIPT[IG.fitSelectedElements()]" />
IG.getSelectedElements() Gets the selected elements from Smart Client.
 <FormField name="SelectedElements" label="Selected elems" type="textfield" datatype="string" persisted="false" 
defaultvalue="SCRIPT[IG.getSelectedElements()]" />
IG.clearSelectedElements() If Smart Client has elements selected in the map, this call clears the selection.
 <FormAction name="ClearSelectedElements" label="clear elements" 
action="SCRIPT[IG.clearSelectedElements()]" />
IG.reloadFeatures(features) Reloads the specified features in Smart Client. The features may be set using the name or the ID of the features.
 <FormAction name="ReloadFeature" label="reload feature" 
action="SCRIPT[IG.reloadFeatures('Building Extension')]" />
IG.setFeaturesVisible(features) Makes the specified features visible in Smart Client. The features may be set using the name or the ID of the features.
 <FormAction name="SetVisibleFeature" label="set visible" 
action="SCRIPT[IG.setFeaturesVisible('Building Extension')]" />
IG.setFeaturesInvisible(features) Hides the specified features in Smart Client. The features may be set using the name or the ID of the features.
 <FormAction name="SetInVisibleFeature" label="reload feature" 
action="SCRIPT[IG.setFeaturesInvisible('Building Extension')]" />
IG.executeCommand(action_command) Exectues an action in Smart Client. The action_command defines the name of the action to execute. The action has to be defined in the Administrator first.
 <FormAction name="executeCommand" label="executeCommand" action="SCRIPT[IG.executeCommand('startAction')]" />
IG.executeSelectionSetQuery(queryName) Exectues a selectionset query in Smart Client. The queryName defines the name of the query to execute. The query has to be defined in the Administrator first.
 <FormAction name="executeQuery" label="executeQuery" 
action="SCRIPT[IG.executeSelectionSetQuery('GetAllParcelsInRangeQuery')]" />
IG.closeWebBrowser() Closes the Web browser.
 <FormAction name="closeWebBrowser" label="closeWebBrowser" action="SCRIPT[IG.closeWebBrowser()]" />
IG.browseInNativeBrowser(url) Opens the native browser with the given url.
 <FormAction name="browseInNativeBrowser" label="browse" 
action="SCRIPT[IG.browseInNativeBrowser('http://smartclient.intergraph.at/documentation')]" />
IG.closeSmartClient() Closes Smart Client.
 <FormAction name="closeSmartClient" label="closeSmartClient" action="SCRIPT[IG.closeSmartClient()]" />


Example: chain calls:

   <FormAction name="ReloadAndSelect" label="Show on Map" action="SCRIPT[IG.reloadFeatures('Building Extension');
    IG.setActiveFeature('Building Extension');IG.setSelectedElements({FORM.ID});IG.fitSelectedElements();IG.clearSelectedElements();IG.closeWebBrowser()]" />



Example: customscript: Save an item, and if the data is stored correctly, reload the feature, and zoom to the item that is shown in the workflow

  1.    IG.saveBuildingExtension = function(nodeid, feature){
  2.       IG.urlSettings.params.nodeid = nodeid;
  3.       var url = IG.getWorkflowUrl('saveData').setParams(IG.urlSettings.params, true).toString();
  4.       var options = {
  5.         url: url,
  6.         type: 'POST',
  7.         data: IG.form ? IG.form.serialize() : {},
  8.         /*
  9.          * If the data is stored correctly, the reload of the featue will be started, and Smart Client zooms to the selected item.
  10.          */
  11.         success: function (data) {
  12.             if (data.Success) {
  13.                 var id = data.Data['ID'];			
  14.                 IG.reloadFeatures(feature);
  15.          	IG.setActiveFeature(feature);
  16.                 IG.setSelectedElements(id);
  17.                 IG.fitSelectedElements();
  18.                 IG.clearSelectedElements();				
  19.                 IG.closeWebBrowser();
  20.             }
  21.             else {
  22.         /*
  23.          * show the exception to the client
  24.          */
  25.                 if (data.Exception) {
  26.                     IG.alertDialog('Data are not correct: <br /><code>' + data.Exception + '</code>', { title: 'Error' });
  27.                 }
  28.                 else {
  29.                     IG.alertDialog('Unknown Error', { title: 'Error' });
  30.                 }
  31.             }
  32.         }
  33.       };
  34.       $.ajax(options);  
  35.     }



Pfeil new.png To the top Pfeil new.png

Complete Sample

Administrator: WorkflowConnection definition

WorkflowConnection.PNG

Administrator: DataSource settings for the feature to edit

FeatureDataSource.PNG

Administrator: Action definition for the action to start the workflow

SampleAction.PNG

Administrator: Allow the respective users, groups, or roles to use your new action 'Edit Land for sale' in the Security section.



Workflow: WorkflowSettings for the current node.

 <WorkflowNode id="100" label="Edit" controller="Form" form="BuildingExtension" follownode="10"> />



Workflow: FormSettings for the current form

  1. <Form name="BuildingExtension" table="BUILDINGEXTENSION" idfield="ID" 
  2.      customscript="BuildingExtension.js">
  3.     	<FormGeometry name="GEOMETRY_SPA" layer="Building Extensions">
  4.     		<NewActions>
  5.     			<GeometryAction name="GE_NEWPOLYGON" isstartonload="true" />
  6.     			<GeometryAction name="GE_COPY"  />
  7.     		</NewActions>
  8.     		<EditActions>
  9.     			<GeometryAction name="GE_MODIFY" label="Edit BE" isstartonload="true"/>
  10.     		</EditActions>
  11.     	</FormGeometry>
  12.     	<FormTab name="General">
  13.     		<FormGroup name="Data">
  14.        			<FormField name="ID" datatype="guidstring" type="textfield" visible="hidden"></FormField>
  15.     			<FormField name="APPLICATIONNUMBER" label="Application No" datatype="string" type="textfield" visible="form,list" 
  16.     						editable="false" 
  17.     					   defaultvalue="SQL[Select Count(ID)+1 From BUILDINGEXTENSION]" ></FormField>
  18.     		    <FormField name="STATUS" label="Status:" type="combobox" datatype="number" required="false" maxlength="22" 
  19.                             lov="OBJECT[StatusValue.GetValues()]" defaultvalue="0"/>    
  20.     		     <FormField name="EDITOR" label="Editor:" type="textfield" datatype="string" required="true" maxlength="20" 
  21.                             visible="form,list" defaultvalue="{USER.NAME}" editable="false"/>
  22.                 <FormField name="EXTENSIONTYPE_ID" label="Type:" type="combobox" datatype="guidstring" required="true" 
  23.                             maxlength="36" visible="form" lov="SQL[Select ID,NAME From EXTENSIONTYPE Order By NAME]" />                        
  24.                 <FormField name="COMMENTS" label="Comments:" type="textarea" 
  25.                 		datatype="string" required="false" maxlength="4000" visible="form" 
  26.                 		authorization="ROLE[LasVegasExpert]"/>
  27.  
  28.     		</FormGroup>
  29.     		<FormGroup name="Address" >
  30. 	    		<FormField name="DISTRICT" label="City" datatype="string" type="combobox" 
  31. 	    		lov="SQL[Select Distinct LOCCITY From CCBUS_X Order by LOCCITY]" visible="form" ></FormField>
  32. 	    		<FormField name="SUBDISTRICT" label="Zip" datatype="string" type="combobox" visible="form" 
  33. 	    					lov="SQL[Select Distinct LOCZIP From CCBUS_X Where LOCCITY={FORM.DISTRICT} and LOCZIP is not null Order By LOCZIP]"></FormField>
  34. 	    		<FormField name="STREET" label="Street" datatype="string" type="combobox" visible="form,list" 
  35. 	    		lov="SQL[Select distinct ADDR From CCBUS_X Where LOCCITY={FORM.DISTRICT} AND LOCZIP={FORM.SUBDISTRICT} Order By ADDR]"></FormField>
  36. 	    		<FormField name="STREETNUMBER" label="Street No" datatype="string" type="combobox" visible="form" 
  37. 	    		lov="SQL[Select distinct STREETNO From CCBUS_X Where LOCCITY={FORM.DISTRICT} AND LOCZIP={FORM.SUBDISTRICT} AND ADDR = {FORM.STREET} Order By STREETNO]"></FormField>
  38. 	    		<FormField name="X" label="X:" type="textfield" datatype="number" required="false" maxlength="22" 
  39.                editable="false" visible="hidden" persisted="false"
  40.                defaultvalue="SQL[Select TOP 1 CAST(c.Geometry_SPA.STX As int) From CCBUS_X c
  41.                     where c.LOCCITY = {FORM.DISTRICT} and c.LOCZIP = {FORM.SUBDISTRICT} 
  42.                     and c.ADDR = {FORM.STREET} and c.STREETNO = {FORM.STREETNUMBER}]" />
  43.     <FormField name="Y" label="Y:" type="textfield" datatype="number" required="false" maxlength="22"  
  44.                editable="false" visible="hidden" persisted="false"
  45.     		   defaultvalue="SQL[Select TOP 1 CAST(c.Geometry_SPA.STY As int) From CCBUS_X c
  46.     		        where c.LOCCITY = {FORM.DISTRICT} and c.LOCZIP = {FORM.SUBDISTRICT} 
  47.                     and c.ADDR = {FORM.STREET} and c.STREETNO = {FORM.STREETNUMBER}]"/>
  48.      <FormField name="PARCEL" label="Parcel:" type="textfield" datatype="number" required="true" maxlength="30"   
  49.                editable="false" visible="form"  
  50.     		   defaultvalue="SQL[Select TOP 1 p.ID From PARCELS p,CCBUS_X c
  51.     		        where c.LOCCITY = {FORM.DISTRICT} and c.LOCZIP = {FORM.SUBDISTRICT} 
  52.                     and c.ADDR = {FORM.STREET} and c.STREETNO = {FORM.STREETNUMBER} and p.PARCEL = c.PARCELNUMB]"/>
  53.                    <FormTable name="" ></FormTable>
  54.     		</FormGroup>
  55.  
  56.     	</FormTab>
  57. 		<FormAction name="TriggerRedirect" label="Redirect" action="SCRIPT[triggerAndRedirect({triggerNames:['SessionSampleTrigger','SessionApplicationNumberTrigger'],nodeid:10})]" />
  58.     	<FormAction name="Save" action="save" />
  59.     	<FormAction name="SaveReload" action="SCRIPT[IG.saveBuildingExtension('Building Extensions')]"></FormAction>
  60.     	<FormAction name="Capture" action="SCRIPT[IG.captureGeometry()]" />
  61.     	<FormAction name="ShowOnMap" action="SCRIPT[IG.setActiveFeature('Building Extensions');IG.setSelectedElements({ROW.ID});IG.fitSelectedElements();IG.clearSelectedElements();IG.closeWebBrowser()]" 
  62.     				visible="list[SQL[Select count(ID) From BUILDINGEXTENSION Where ID = {ROW.ID} And GEOMETRY_SPA Is Not Null]]" type="row" image="ig-icon-search"/>
  63.     </Form>



FAQ

test To the top Pfeil new.png

Provider could not be initialized: SessionContextProvider

Cannot edit existing geometries

Language: English