GMSC Discussions

GeoMedia Smart Client community discussion board is where you can create, contribute and share information and knowledge in regards to configuring as well as working with GeoMedia Smart Client. Find your answers, share your knowledge and help build a strong GeoMedia Smart Client community.
Showing results for 
Search instead for 
Do you mean 
Frequent Contributor
Posts: 108
Registered: ‎09-18-2018
Accepted Solution

Callback function for IG.captureGeometry? Features goes active after run captureGeometry.

[ Edited ]




Goal :  a feature that is built from a table View that aims to show gather information from several databases with a geometry provided from users of SmartClient.


For that, I built a feature with an Identifier and two geometry columns (Geometry_SPA and Geometry) named G_Feature. Also I will have another that is my dataview table named DV_feature that is a result of several joins from different databases including the one with G_Feature for geometry information.


Therefore I built a workflow that is triggered from an action defined on my DV_feature  that have an IG.geometryCapture() button action to save my geometry information on G_Feature.


As DV_feature is a view of G_Feature I will be able to see my DV_Feature on map.


So far so good and it works fine.


My only issue now is when I execute my action button on my workflow that will run the 'IG.geometryCapture()' and activate the G_Feature even if this feature is hidden. I don't want to activate G_Feature as I want G_feature only for geometry. 


So my ideia is to do something after geometryCapture is done. Something like:

IG.captureGeometry().done(function(){ IG.setActiveFeature( DV_feature ); })


Any suggestions? Thank you.

Super Contributor
Posts: 455
Registered: ‎10-12-2015

Re: Callback function for IG.captureGeometry? Features goes active after run captureGeometry.

I don't believe an straight callback function can be used in this situation.

"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."
i.e. no javascript callback can be envoked once the geometry edit is complete as the form the javascript ran on was closed.


To recap - once the geometry edit / capture is complete you want to set a different feature as active.


One way to work around it is to have an form load event so when the form is reloaded after geometry edit/capture you can then set the desired feature as active.

For my example the feature is a BusStop which his simpleid 209. The Workflow node id is '2'.

i. Workflow node - make sure the 'Follow Node' is set to the node being edited.
e.g. If Node '2' is the name of the node with the form, set the 'Follow Node' to 2. If Follow Node is not popuulated then the form won't be re-loaded once the capture is complete and you can't do anything (unless you write some Java code).


Note: the follow on form could be a different form, as long as it has the form:ready logic added.


ii. Add a custom script resource to the form to run onload. e.g. formReady
In the script add something like

IG.vent.on('form:ready', function(form){
if (IG.getActiveFeature() != 209)



That should set your desired feature set to active again.And could hide your unwanted hidden feature again.

User can then close the form and continue.

Hopefully that is all you need.




If you need a more complex logic to sort out the active feature, you may need to retain some additional information through the catpure-edit geometry process. One way to do that is via action session triggers. e.g. Perhaps you need to record the actual feature key id or id of a feature to set active or similar.
a. For the feature (e.g. busstop) workflow node add two action triggers
Type: SessionTrigger
Key: SessionBusStopID
Value: Placeholder REQUESTCONTEXT, Key SessionBusStopID
Type: RemoveSessionTrigger
Key: SessionBusStopID



b. Add a hidden text field to the form that holds the session variable so it can be accessed in the form on re-load.
Name: SessionBusStopIDField
default value: place holder, session and set Key to the key of the session trigger. e.g. SessionBusStopID
Visible: unchecked (though I had problems with setting to unchecked - code wouldn't work, have not come back to that)
Required: unchecked



c. Add to the javascript that envokes IG.captureGeometry() to envoke the first session action trigger. Something like
//Pass through a value from the form to the session trigger


//or alternative pass thorugh id of feature to make active after reload



d. Update the form onload script to handle the additional logic.
The value you put in the session value will now be in the hidden form field.
IG.vent.on('form:ready', function(form){
IG.notify("Doing nothing as yet to edit geometry.", {fadeOut: true, delay:7000}).show()
} else {
//Add logic to process what ever was passed in via the session variable
IG.trigger({triggerNames:['ActionRemoveSessionBusStopID']}); //clean up session value as edit - form display cycle complete

//hmmm, getValue() only seems to work if field is visible. Have not looked at that further.

IG.notify(IG.form.getItemById('SessionBusStopIDField').getValue(), {fadeOut: true, delay:7000}).show()