qwat / QWAT

TEKSI Water module (project QWAT) - QGIS project
https://www.teksi.ch
GNU General Public License v2.0
58 stars 31 forks source link

Dynamic link on hydrant for hinni system #262

Closed varrieta closed 4 years ago

varrieta commented 6 years ago

For Hinni hydrants, we have to integrate an URL linking to the Hinni system. The URL is made of a static part, the link, and a dynamic part, the identifier of the hydrant.

Does anyone else have to deal with Hinni hydrants links?

varrieta commented 6 years ago

Since the link doesn't need to be saved in the database, I use a qgs open action to create and then open the URL. Simple and efficient, if anyone needs to do the same.

ponceta commented 6 years ago

On my side I added to that a virtual field with external ressource as attribute type and active url.

image

I had to remove space characters (that's why regex_replace):

regexp_replace(concat( 'https://kontrollsysteme.hinni.ch/dbhvista/?mkey=****MySecureKey****&ShowEntityDesignation=', "identification" ),' ','')

This is then directly accessible from the hydrant form.

For the python script action :

image

https://kontrollsysteme.hinni.ch/dbhvista/?mkey=****MyPrivateKey****&ShowEntityDesignation=[%CASE
    WHEN length("identification") > 3 THEN replace("identification", ' ' ,'')
    ELSE left("identification",1) || '0' || right("identification",1)
END%]&et=1

This could be somewhere documented as it is a common use case at least in Switzerland.

haubourg commented 6 years ago

Why not add some Hinni valves in the demo dataset , propose a QML example somewhere and a "Tips and tricks" section in the documentation or web site?

ponceta commented 4 years ago

Opened a documentation issue. https://github.com/qwat/docs/issues/9