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: 159
Registered: ‎01-14-2018
Accepted Solution

Run Postgis query inside M.App Enterprise

Dear all,

 

I am using postgreSQL as my database for the data in M.App Enterprise,

I have a workflow that should run a postgis query (filling a 'state_name' column in a points table using the 'ST_Within'), so I created an .exe to run that query and I run it from the workflow,

 

but I am wondering if there is an internal way in M.App Enterprise to run this workflow without creating an exe?

 

Best regards

Khaled

Highlighted
Staff
Posts: 1,051
Registered: ‎10-18-2015

Re: Run Postgis query inside M.App Enterprise

Hi Khaled,

 

how do you run that exe from the workflow? 

In general this task should be easily achievable using a workflow trigger.

 

HTH,

Stefano

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

Re: Run Postgis query inside M.App Enterprise

Hi Stefano,

 

the answer about how I run an exe: In the actionset I made an action group then choosed: 'open file' then write down the exe path in the 'Path' field.

 

I have a question about the 'workflow trigger', in this case I want to run the query only once.

I have another case which I draw a line feature and I want fill in its length in a field in its table.

 

Do you have a practical example to make a trigger, as I tried to make it but errors continues appearing.

 

Kind Regards

Khaled

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

Re: Run Postgis query inside M.App Enterprise

hi Khaled,

 

in this case you need to have connectivity to the database from the client side or your exe will have to use a component on the server to run the query.

If you define a trigger that will be run on the M.App Enterprise server instead. Here is a working sample (in this case the syntax is from SQLServer, but it would work also in PostGIS with a few adjustments):

 

Capture.PNG

 

HTH,

Stefano

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

Re: Run Postgis query inside M.App Enterprise

Many thanks Stefano it works as follows:

  1. I made an SQLTrigger in the 'After', changed its name
  2. then in 'SQL' field I wrote down in the 'Static Value' field -> the Update statement like that : 'Update streets Set length = ST_Length(streets.geom)