M.App Enterprise Discussions

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 79
Registered: ‎11-15-2018
Accepted Solution

MAE Desktop Workflow: problems with NEW follownode EDIT

Hi,

 

we have following problem in MAE Desktop:
First we want to create a new point in map (node NEW).
After creating geometry and ID workflow should automatically open follownode (node EDIT), where you can edit further fields.

 

Creating new entry works fine: ID and geometry are created (we can see entry in database)
follownode opens, but ID is empty!
So we can't configure further fields and save them.
What are we doing wrong?
Or perhaps, does workflow EDIT opens too fast, before node NEW didn't has finished saving ID and geometry in database?

 

workflowsettings:

<WorkflowNode id="10" label="Bemerkungen"   form="NEW"  controller="Form" emptyform="true" follownode="11"/>	
<WorkflowNode id="11" label="Bemerkungen"   form="EDIT"  controller="Form" />	

formsettings:

<Form name="NEW" table="Abwasser_Bemerkung" idfield="ID">		
	<FormTab name="ABW_BemerkungNEU" label="xxx">
		<FormAction name="Geometry_SPA" label="xxx" action="SCRIPT[SC.Map.clearSelectedElements();SC.digitize('Bemerkung', {commands: ['NEWPOINT'], startOnLoad: 'NEWPOINT'})]" submit="true" />		
        <FormGroup name="BemerkungErstellen" label="xxx">	 	
				<!-- ID will automatically be generated in DB on INSERT -->
				<FormField name="ID" label="ID:" type="textfield" editable="false" visible="hidden"					
					datatype="string"  maxlength="36" persisted="true"/>						
		</FormGroup>
		...


<Form name="EDIT" table="Abwasser_Bemerkung" idfield="ID" > 			
	<FormTab name="ABW_Bemerkung_Tab" label="xxx">		
		<FormGroup name="Allgemein" label="Info">			
			<FormField name="ID" label="ID:" type="textfield" visible="form" defaultvalue="{SESSION.Abwasser_Bemerkung.ID}"
				datatype="string" maxlength="36"/>
				
			<FormField name="Info" label="xxx" type="textarea"  visible="form"					   
					   defaultvalue="SQL[ SELECT Info FROM Abwasser_Bemerkung WHERE ID = {FORM.ID}]" required="true" persisted="true"  />					   
	    </FormGroup>
		...

Thank you very much,
regards, Iris

Staff
Posts: 1,136
Registered: ‎10-18-2015

Re: MAE Desktop Workflow: problems with NEW follownode EDIT

Hi Iris,

 

looks like your workflow definition has been defined directly in the xml files. Just some suggestions to avoid that you override the default behavior of the workflow:

  1. do not use defaultvalue of the ID assigning value from the session, it is the out of the box behavior of the form is the node does not have the emptyform attribute set. In addition the workflow engine takes automatically the variable name based on the underlying table name and primary key name
  2. it is also not needed to set the defaultvalue of the info field, again the workflow engine does this by default based on the currently loaded object
  3. it is not guaranteed that your call to the SC.Map.clearSelectedElements() method will be performed before starting the digitize. The JS API is asynchronous. Also in this case it is not needed since you set the emptyform attribute to true.  

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Frequent Contributor
Posts: 79
Registered: ‎11-15-2018

Re: MAE Desktop Workflow: problems with NEW follownode EDIT

Hi Stefano,

Thank you for your very quick response!

 

I used structure of workflows like we used in smartclient, so I copied code directly to xml Smiley Wink

 

statement 3: 

I used SC.Map.clearSelectedElements() before I configured emptyform="true", so this is not necessary here any more (and you are right, I didn't consider asynchrous behaviour for clearSelectedElements())

 

statement 1:
in smartclient we used Session value, when we wanted to load value of selected object in map, so I also used it here
(EDIT workflow also should show values if you select an object in card, not only if you configure a new object in card).

I deleted defaultvalue configuration for ID and for Info field in EDIT:

a) we still can see right behaviour if we want to see infos of an already configured object Smiley Happy
   This a new behaviour between workflows in MAE Desktop and in smartclient, isn't it?

b) But if we create a new object, I still see no value for ID in follownode EDIT

 

statement 2:
ok we don't need this any more, but would it be wrong to set defaultvalue or does it has disadvantages
if we do this (because we have workflows configured in smartclient which we want to use in MAE desktop)?

 

formsettings:

<Form name="NEW" table="Abwasser_Bemerkung" idfield="ID">		
	<FormTab name="ABW_BemerkungNEU" label="xxx">			
		<FormAction name="Geometry_SPA" label="xxx" action="SCRIPT[SC.digitize('Bemerkung', {commands: ['NEWPOINT'], startOnLoad: 'NEWPOINT'})]" submit="true" />
		
        <FormGroup name="BemerkungErstellen" label="xxx">	 	
				<FormField name="ID" label="ID:" type="textfield" editable="false" visible="hidden"					
					datatype="string"  maxlength="36" persisted="true"/>
					
<Form name="EDIT" table="Abwasser_Bemerkung" idfield="ID" > 			
	<FormTab name="ABW_Bemerkung_Tab" label="xxx">	
		<FormGroup name="Allgemein" label="Info">		
			<FormField name="ID" label="ID:" type="textfield" editable="false" visible="form"					
				datatype="string"  maxlength="36" persisted="true"/>							
					   		
			<FormField name="Info" label="xxx" type="textarea"  visible="form"					   
					   required="true" persisted="true"  />				   
	    </FormGroup>

many thanks, regards Iris

 

Staff
Posts: 1,136
Registered: ‎10-18-2015

Re: MAE Desktop Workflow: problems with NEW follownode EDIT

Hi Iris,

 

the workflow manager in GMSC and MAE is basically the same. What changes is mainly the JS API and some of the features that are missing in MAE (reporting, formmaps, ...).

You can still explicitly set the defaultvalues, I suggest not to use it just to avoid confusion (sometimes with this approach you may select the wrong session variable name).

Selection on the map or in a list/form controller is basically the same: a new variable in the session gets stored with the id of the selected object. If the variable is already there it just gets updated with the new value.

 

About your issue: what DB are you using? Please check if ID is correct to be uppercase, because the JS API is case sensitive.

 

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Frequent Contributor
Posts: 79
Registered: ‎11-15-2018

Re: MAE Desktop Workflow: problems with NEW follownode EDIT

we use SQL-Sever, 

ID in DB is in uppercase

we configured ID as: nvarchar(36) , NOT NULL, primary Key

and we generate ID via newid()

 

Many thanks!

Staff
Posts: 1,136
Registered: ‎10-18-2015

Re: MAE Desktop Workflow: problems with NEW follownode EDIT

normally SQL Server is case insensitive, but you can check it with the following statement:

 

 

SELECT SERVERPROPERTY('COLLATION')

if the output is something like SQL_Latin1_General_CP1_CI_AS then it is CI canse insensitive.

 

I would check what's causing the error using fiddler to check how parameters are being passed to the workflow manager.

 

Stefano

 

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Frequent Contributor
Posts: 79
Registered: ‎11-15-2018

Re: MAE Desktop Workflow: problems with NEW follownode EDIT

our server is case insensitive (Latin1_General_CI_AS)

Frequent Contributor
Posts: 79
Registered: ‎11-15-2018

Re: MAE Desktop Workflow: problems with NEW follownode EDIT

Hi Stefano,

 

Because you mentioned asynchronous behaviour for SC.Map.clearSelectedElements()
I wanted to improve our form: it uses a delete function with SC.Map.clearSelectedElements()
I configured clearSelectedElements() with promise, but I think it never reaches promise.

 

<FormAction name="Delete" label="Löschen" action="SCRIPT[IG.confirm({message: 'Möchten Sie die Bemerkung wirklich löschen?', 
title: 'Bestätigung', okMessage: 'Ja', cancelMessage: 'Nein', callback: function() { 
IG.remove();
SC.Map.clearSelectedElements().then(function(){ 
alert('In promise');
SC.Map.reloadLayers('Bemerkung'); 
SC.Map.closeWebBrowser(); }) } })]"
visible="form[SQL[select count(ID) from Abwasser_Bemerkung where ID={FORM.ID}]]"/>


The output of workflow by clicking Delete:
-> workflow ist beendet

But our alert statement 'In promise' doesn't appear.

 

Thank you very much,
regards Iris

Staff
Posts: 1,136
Registered: ‎10-18-2015

Re: MAE Desktop Workflow: problems with NEW follownode EDIT

IG.remove does also provide callback, please have a look at the following sample

 

var busyDialog = IG.Busy({message: 'A processar'});
IG.remove({controller: 'Form', action:'Delete', id:{FORM.ID1}, follownode: 14}).done(function(){
	IG.reloadPage();
	busyDialog.close();
});
Stefano Turcato
Presale Engineer
Hexagon Geospatial
Frequent Contributor
Posts: 79
Registered: ‎11-15-2018

Re: MAE Desktop Workflow: problems with NEW follownode EDIT

Hi Stefano,

 

we solved the problem Smiley Happy

 

up to now:
ID of type nvarchar(36) was created automatically in database via newid().
ID is generated in database correctly when new entry is created but follownode had empty ID (why ?).

 

now:
I deleted newid() generation in database and used datatype="guidstring" in workflow,
everything works fine.
ID is created and follownode knows about created ID via guidstring.

 

thank you very much for your help,
regards, Iris