Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Contributor
Posts: 23
Registered: ‎11-09-2015
Accepted Solution

Edit feature without form.

Hello

I want to edit an area from inside Smart Client without showing a form. Is there an easy way to do this?

Here is the flow so far.. You do a Search and get a datagrid with feature rows you select on one of them and call the edit feature action

inside contextelement to start workflow. Then in a form customscript.js I placed the following. 

 

IG.vent.on('form:ready', function (context) { 
IG.captureGeometry();

});

 

This kindof work but not the first time. Also this doesn't allow me to move on to the next area. 

 

I have a follow up workflow with the following in the customscript.js

 

 

IG.vent.on('form:ready', function (context) {
IG.closeWebBrowser();
});

 

but haven't been albe to get to this.

 

Any ideas on how to achieve this?

Thanks!

 

 

Staff
Posts: 966
Registered: ‎10-19-2015

Re: Edit feature without form.

[ Edited ]

Hi Anchen,

 

it should work, but you have to find a way to get a different "state" in your form just after the editing process. This way you can manage also the case where the user cancel the capturing and gets redirected to the previous form.

 

You may use a session variable to understand if the editing has already taken place. So for instance you can start the workflow from the node "StartEdit":

 

<WorkflowNode id="StartEdit" controller="Workflow" follownode="Edit" >
	<WorkflowTrigger type="SessionTrigger" method="after" name="FlagEditTo1">
	   <Param name="Key" value="FLAG_EDIT"/>
	   <Param name="Value" value="1"/>
	</WorkflowTrigger>
</WorkflowNode>
<WorkflowNode id="Edit" controller="Form" form="EditForm" >
	<WorkflowTrigger type="SessionTrigger" method="action" name="FlagEditTo0">
		<Param name="Key" value="FLAG_EDIT"/>
		<Param name="Value" value="0"/>
	</WorkflowTrigger>  
</WorkflowNode>

and then in the Edit form you can have a script like this:

 

IG.vent.on('form:ready', function (form) {
	var id = IG.getItemById('ID');
	if (!_.isEmpty(id) && !_.isEmpty(id.getValue())) 	
	{
		if (IG.getItemById('FLAG_EDIT').getValue() == 1) {
			IG.trigger({triggerNames:'FlagEditTo0'}).done(function (result) {
				IG.captureGeometry();
			});
		} else {
			IG.closeWebBrowser();
		};
	}            
});

Regards,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Contributor
Posts: 23
Registered: ‎11-09-2015

Re: Edit feature without form.

Please find the complete sollution as created with Stefano:

 

Workflow:

 <WorkflowNode id="StartEdit" controller="Workflow" follownode="EditStructure" >
    <WorkflowTrigger type="SessionTrigger" method="after" name="FlagEditTo1">
      <Param name="Key" value="FLAG_EDIT"/>
      <Param name="Value" value="1"/>
    </WorkflowTrigger>
  </WorkflowNode>
  <WorkflowNode id="EditStructure" controller="form" form="DSEditForm" >
    <WorkflowTrigger type="SessionTrigger" method="action" name="FlagEditTo0">
      <Param name="Key" value="FLAG_EDIT"/>
      <Param name="Value" value="0"/>
    </WorkflowTrigger>
  </WorkflowNode>
  <WorkflowNode id="OverviewProduction" controller="List" form="ProductionUnitForm" follownode="NewStructure">
  <WorkflowNode id="NewStructure" controller="form" form="DSNewForm" emptyform="true" />
  </WorkflowNode>
</WorkflowRoot>

and then in the startEdit.js Script file:

 

IG.vent.on('form:ready', function (form) {  
	var id = IG.getItemById('ID1');
	if (id != undefined) {	   
		IG.getItemById('FLAG_EDIT').reload();
		setTimeout(function () {		    
		    if (IG.getItemById('FLAG_EDIT').getValue() == 1) {		     
			IG.trigger({triggerNames:'FlagEditTo0'}).done(function (result) {
				IG.captureGeometry();
			});
} else {  
			IG.closeWebBrowser();
		};
		},100);
	}            
});

and in the DSEditForm add the FLAG_EDIT field:

<FormField  name="FLAG_EDIT"  type="textfield" required="false"  persisted="false" defaultvalue="{SESSION.FLAG_EDIT}" />
Frequent Contributor
Posts: 90
Registered: ‎10-13-2015

Re: Edit feature without form.

Hi guys, 

 

as I understand it, it still opens the form, but directly after event form:ready, it starts the editing action. But user can see the form window until the form:ready event is fired. Am I right?

 

Jakub

Contributor
Posts: 23
Registered: ‎11-09-2015

Re: Edit feature without form.

Yes Jakub so depending on the speed sometimes you only see the outline of the form. Other times the whole form acutally comes up before it jumps to the Smart Client map and editing capability. 

Occasional Contributor
Posts: 12
Registered: ‎10-14-2015

Re: Edit feature without form.

Hi,

 

I manage to run the Edit Geometry feature without from with following javascript, but somehow after edit geometry the javascript does not run the .done() ... any idea how i can fix it ?

 

TR.EditDesignGeom = function(feature,fid,JName){
    IG.setActiveFeature(feature);
    IG.setSelectedElements(fid);
    IG.fitSelectedElements();
 
    IG.startEdit(feature, 'GE_MODIFY[true]', IG.convertToArray(fid), null, IG.url('SmartClient/SaveGeometries').includeWorkflowContext({ includeId: true, postForm: false }).toString({ absolute: true }))
        .done(function () {
            alert('Done');
        })
        .fail(function (message, exception) {
            alert('Fail ' + message);
        });
}

 

regards,

Cath.

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.