Hexagon Geospatial
MENU

M.App Enterprise

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
Highlighted
Frequent Contributor
Posts: 94
Registered: ‎01-14-2018
Accepted Solution

filling the user name in a column inside the feature table

[ Edited ]

Dear all,

 

In M.App Enterprise, I am using workflow to do some tasks as filling a column in the feaure table with some text, drawing new points to my feauture or editing the original one.
My question  is I want to write down the M.App Enterprise user name in column for each change he made to it.
Note I am using PostgreSql as my db.

 

Best regards

Khaled

Staff
Posts: 376
Registered: ‎11-12-2015

Re: filling the user name in a column inside the feature table

One way to do this:

Expose the user column from the feature table in the form as a text field and apply a default value for this field to capture the USERNAME from the SESSION table. In this way the USERNAME is available to be captured when completing workflow tasks.

username.PNG

 

HTH

Frequent Contributor
Posts: 94
Registered: ‎01-14-2018

Re: filling the user name in a column inside the feature table

Thanks for your response, but an error appeared 

"Following fields are defined in metadata but cannot be retrieved 'user'."

 

Could you help in that 

 

Thanks

Khaled

 

Staff
Posts: 376
Registered: ‎11-12-2015

Re: filling the user name in a column inside the feature table

Hi Khaled,

 

I may be able to help further here, but I need more information specific to this error.

What is happening at the point the error is encountered? Is this error a pop up message or are you retrieving it from the M.App Enterpise log in Studio? Further explanation of the point of failure with screenshots would help here.

Frequent Contributor
Posts: 94
Registered: ‎01-14-2018

Re: filling the user name in a column inside the feature table

Once I open the form the following message apears

Untitled.png

 

Then I checked the error log in Studio as follows

Untitled.png

Staff
Posts: 376
Registered: ‎11-12-2015

Re: filling the user name in a column inside the feature table

Thanks Khaled.

 

 

It seems as though the 'user' is set to peristed in the workflow is that correct?

The persisted parameter should be set to 'false'

 

After doing so, make sure to save the workflow in workflow editor and reload it in the MAE client.

 

HTH

 

Frequent Contributor
Posts: 94
Registered: ‎01-14-2018

Re: filling the user name in a column inside the feature table

Thanks that resolved the error,

 

But I have another problem that this username is not written in the row of my table although I made my worflow and saved it,

Untitled.png

 

What I need to do is when I edit a row in the workflow I want to know which user made that edit (his name to be written in column 'user')

 

Thanks for your prompt response

Khaled

Staff
Posts: 807
Registered: ‎10-18-2015

Re: filling the user name in a column inside the feature table

[ Edited ]

hi Khaled,

 

it would help if you can post your table definition and the xml of the form configuration.

 

Thanks,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Frequent Contributor
Posts: 94
Registered: ‎01-14-2018

Re: filling the user name in a column inside the feature table

Hi Stefano,

Below is the form xml, and attached I sent the table definition

 

<?xml version="1.0"?>

-<FormList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">


-<Form isfilterareaopen="false" customscript="zoomTo.js" pagesize="20" table="qena_changes" idfield="gid" editable="true" name="List">


-<FormTab editable="true" name="NewTabPage2" visible="true">


-<FormGroup editable="true" name="NewGroup2" visible="true">

<FormField editable="true" name="gid" visible="list" type="textfield" saveinsession="false" persisted="true" required="true" datatype="number"/>

<FormField editable="true" name="id" visible="list,filter" type="textfield" saveinsession="false" persisted="true" required="true" datatype="number" lov="SQL[Select id from qena_changes ORDER BY id]" label="مسلسل"/>

<FormField editable="true" name="ch_lat" visible="list" type="textfield" saveinsession="false" persisted="true" required="true" datatype="number" label="خط عرض"/>

<FormField editable="true" name="ch_long" visible="list" type="textfield" saveinsession="false" persisted="true" required="true" datatype="number" label="خط طول"/>

<FormField editable="true" name="gov" visible="list" type="textfield" saveinsession="false" persisted="true" required="true" datatype="string" label="محافظة"/>

<FormField editable="true" name="sec" visible="list,filter" type="combobox" saveinsession="false" persisted="true" required="true" datatype="string" lov="SQL[Select distinct sec from qena_changes]" label="مركز"/>

<FormField editable="true" name="shy" visible="list,filter" type="combobox" saveinsession="false" persisted="true" required="true" datatype="string" lov="SQL[Select distinct shy from qena_changes]" label="شياخة"/>

<FormField editable="true" name="ch_des" visible="list,filter" type="combobox" saveinsession="false" persisted="true" required="true" datatype="string" lov="SQL[SELECT distinct typeofchange FROM ch_types]" label="نوع التغير"/>

<FormField editable="true" name="address" visible="list" type="textfield" saveinsession="false" persisted="true" required="true" datatype="string" label="العنوان"/>

<FormField editable="true" name="reply" visible="list" type="textfield" saveinsession="false" persisted="true" required="true" datatype="string" label="الرد"/>

</FormGroup>

</FormTab>

<FormAction editable="false" name="ZoomTo" visible="true" type="row" label="تكبير النقطة" action="SCRIPT[zoomTo('qena_changes',{ROW.gid})]"/>

</Form>


-<Form table="qena_changes" idfield="gid" editable="true" name="Form" label="التصنيف">


-<FormTab editable="true" name="NewTabPage1" visible="true">


-<FormGroup editable="true" name="NewGroup1" visible="true">

<FormField editable="false" name="gid" visible="hidden" type="textfield" saveinsession="false" persisted="true" required="false" datatype="number" override="false" defaultvaluemode="onload"/>

<FormField editable="false" name="id" visible="true" type="textfield" saveinsession="false" persisted="true" required="false" datatype="number" label="مسلسل" override="false" defaultvaluemode="onload"/>

<FormField editable="false" name="ch_lat" visible="true" type="textfield" saveinsession="false" persisted="true" required="false" datatype="number" label="خط عرض" override="false" defaultvaluemode="onload"/>

<FormField editable="false" name="ch_long" visible="true" type="textfield" saveinsession="false" persisted="true" required="false" datatype="number" label="خط طول" override="false" defaultvaluemode="onload"/>

<FormField editable="false" name="gov" visible="true" type="textfield" saveinsession="false" persisted="true" required="false" datatype="string" label="محافظة" override="false" defaultvaluemode="onload"/>

<FormField editable="false" name="sec" visible="true" type="textfield" saveinsession="false" persisted="true" required="false" datatype="string" label="مركز" override="false" defaultvaluemode="onload"/>

<FormField editable="false" name="shy" visible="true" type="textfield" saveinsession="false" persisted="true" required="false" datatype="string" label="شياخة" override="false" defaultvaluemode="onload"/>

<FormField editable="false" name="user" visible="true" type="textfield" saveinsession="false" persisted="false" required="false" datatype="string" override="false" defaultvaluemode="onload" defaultvalue="{SESSION.USERNAME}"/>

<FormField editable="true" name="ch_des" visible="true" type="combobox" saveinsession="false" persisted="true" required="true" datatype="string" lov="SQL[SELECT distinct typeofchange FROM ch_types]" label="نوع المتغير" override="false" defaultvaluemode="onload"/>

<FormAction editable="true" name="save" visible="true" label="save" action="save"/>

</FormGroup>

</FormTab>

</Form>

</FormList>

Kind regards,

Khaled

Staff
Posts: 376
Registered: ‎11-12-2015

Re: filling the user name in a column inside the feature table

Hi Khaled,

 

There is going to be multiple ways to do this, but one way would be to use an After trigger with a SQL UPDATE statement so that the column 'user' gets SET to 'SESSION.USERNAME'

 

HTH

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Development Ticket through our Development Ticket Portal.