01-19-2021 12:58 AM
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
Solved! Go to Solution.
01-19-2021 01:15 AM
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:
HTH,
Stefano
01-19-2021 03:32 AM
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
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
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
01-19-2021 03:42 AM
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
01-19-2021 03:51 AM
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!
01-19-2021 05:31 AM
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
01-19-2021 05:41 AM
our server is case insensitive (Latin1_General_CI_AS)
01-19-2021 06:14 AM
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
01-19-2021 07:32 AM
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(); });
01-20-2021 03:30 AM
Hi Stefano,
we solved the problem
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