<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;
        mso-fareast-language:EN-US;}
span.EmailStyle24
        {mso-style-type:personal-reply;
        font-family:"Verdana","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="DA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:windowtext">Hi Casper,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:windowtext">So nice to see you answering questions at the QGIS user list.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:windowtext">Your knowledge is appreciated
</span><span lang="EN-US" style="font-size:10.0pt;font-family:Wingdings;color:windowtext">J</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:windowtext">  <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:windowtext"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="line-height:8.0pt"><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><b><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray">Lene Fischer<o:p></o:p></span></b></p>
<p class="MsoNormal" style="line-height:8.0pt"><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA">Associate Professor</span><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";mso-fareast-language:DA"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><b><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray">University of Copenhagen<o:p></o:p></span></b></p>
<p class="MsoNormal" style="line-height:8.0pt"><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA">Department of Geoscience and Natural Resource Management<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA">Forest and Landscape College<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA">Nødebovej 77a<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA">3480 Fredensborg<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA">Denmark<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA">MOB +45 40115084<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><a href="mailto:lfi@ign.ku.dk" title="lfi@ign.ku.dk"><u><span lang="DA" style="color:gray;text-decoration:none">lfi@ign.ku.dk</span></u></a></span><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:12.0pt"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><img border="0" width="320" height="122" id="Picture_x0020_2" src="cid:image001.gif@01D31B5F.195859E0"></span><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"> 
<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><o:p> </o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:8.0pt"><a href="@Lene_Fischer"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA;text-decoration:none"><img border="0" width="25" height="25" id="Picture_x0020_3" src="cid:image002.png@01D31B5F.195859E0"></span></a><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA">
<span lang="EN-GB"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:8.0pt"><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:gray;mso-fareast-language:DA"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:windowtext"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:DA">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:DA">
 Qgis-user [mailto:qgis-user-bounces@lists.osgeo.org] <b>On Behalf Of </b>Casper Bertelsen<br>
<b>Sent:</b> 22. august 2017 15:45<br>
<b>To:</b> qgis-user@lists.osgeo.org<br>
<b>Subject:</b> Re: [Qgis-user] Updating a field set with default global variable on edit<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:"Tahoma","sans-serif"">Hi Ross,<br>
<br>
If you make your project without saving username and password, the project will prompt for a user and password when opened. Then each member can login using their assigned login and thus making it possible to use current_user in postgres.<br>
<br>
To remove saved username and password from your current project file (make a copy, beforehand), you can open it in a text editor and seach for <layername> untill you find
<br>
<br>
</span><span style="font-family:"Tahoma","sans-serif";color:red"><datasource>dbname='xx' host=yy port=5432
</span><span style="font-family:"Tahoma","sans-serif"">four lines above <layername> and remove the username and password-part only .<br>
<br>
</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif"">Mvh. / Best regards</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:"Tahoma","sans-serif"">Casper Bertelsen</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal">On 22/08/2017 15:36, McDonaldR wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:#1F497D">Thanks Karl-Magnus</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">We use triggers in the database already and they work perfectly but if we want to record the specific user creating and editing features then we’d have to create separate projects for each user.  At the moment
 the team of about 10 users all use a set of centrally stored project files – one for each different task.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">I found this post on Stackexchange (<a href="https://gis.stackexchange.com/questions/217011/how-to-automatically-update-wfs-edits-with-a-user-id">https://gis.stackexchange.com/questions/217011/how-to-automatically-update-wfs-edits-with-a-user-id</a>)
 where global variables are used to populate fields when features are added.  However, as Matthias notes in the comments this doesn’t work on feature  “update”.  If this were possible then it would meet all our needs.  Maybe something that could be funded?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Ross</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB"> Karl Magnus
 Jönsson [<a href="mailto:Karl-Magnus.Jonsson@kristianstad.se">mailto:Karl-Magnus.Jonsson@kristianstad.se</a>]
<br>
<b>Sent:</b> 22 August 2017 12:34<br>
<b>To:</b> McDonaldR; <a href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a><br>
<b>Subject:</b> SV: [Qgis-user] Updating a field set with default global variable on edit</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><a name="T_Default_Reply"><span lang="SV" style="color:#1F497D">Hi!</span></a><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">I’ve made the same things with triggers in the database. To avoid getting same username I’ve chosen not to save the username and password in the project. But then the user have to enter it every
 time the projects opens. If you can find a solution to your suggested approach it would be nice.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"> </span><o:p></o:p></p>
<div>
<p class="MsoNormal"><b><span lang="SV" style="font-size:10.0pt">Karl-Magnus </span>
</b><o:p></o:p></p>
</div>
<p class="MsoNormal"><span lang="SV" style="color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="SV" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:SV">Från:</span></b><span lang="SV" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:SV"> Qgis-user [<a href="mailto:qgis-user-bounces@lists.osgeo.org">mailto:qgis-user-bounces@lists.osgeo.org</a>]
<b>För </b>McDonaldR<br>
<b>Skickat:</b> den 22 augusti 2017 13:12<br>
<b>Till:</b> <a href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a><br>
<b>Ämne:</b> [Qgis-user] Updating a field set with default global variable on edit</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span lang="SV"> </span><o:p></o:p></p>
<p class="MsoNormal">Hi List,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="background:white">Anyone know how to update a field that has a global variable set as the default value when records are edited (geometry and/or attributes)?</span><o:p></o:p></p>
<p class="MsoNormal"><br>
<span style="background:white">We have a QGIS project with a PostGIS layer loaded and configured with look-ups and relations so the users can update all the relevant fields. There are also "<b>created_by</b>" and "<b>updated_by</b>" fields. These are updated
 by a trigger in the database with the "<b>current_user</b>" database variable. This works fine if you are the current user that added the layer to the project - the trigger works perfectly.
</span><br>
<br>
<span style="background:white">If you give the project to someone else and they create and edit features in the layer the fields are still updated with your name as you are the person who added the layer to the project. Not what we want.</span><br>
<br>
<span style="background:white">QGIS has global variables and there are some new ones -
<b>user_account_name</b> and <b>user_full_name</b> that can be set as default values for the fields. When a new feature is created the field is populated with the correct name. Which is what we want.</span><br>
<br>
<span style="background:white">However, when we update an existing record we'd like the "<b>updated_by</b>" field to be updated with the current "<b>user_account_name</b>". Like a trigger in the database would do on update. Then we would have a better idea
 of the history of the feature.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="background:white"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="background:white">Ross</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt">Ross McDonald | </span></b><span style="font-size:10.0pt">GIS Data Coordinator | Angus Council, People, IT | Angus House, Orchardbank Business Park, Sylvie Way, Forfar DD8 1AT<b> | t: 01307 476419</b></span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">This message is strictly confidential. If you have received this in error, please inform the sender and remove it from your system. If received in error you may not copy, print,
 forward or use it or any attachment in any way. This message is not capable of creating a legal contract or a binding representation and does not represent the views of Angus Council. Emails may be monitored for security and network management reasons. Messages
 containing inappropriate content may be intercepted. Angus Council does not accept any liability for any harm that may be caused to the recipient system or data on it by this message or any attachment.
</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:DA"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">This message is strictly confidential. If you have received this in error, please inform the sender and remove it from your system. If received in error you may not copy, print,
 forward or use it or any attachment in any way. This message is not capable of creating a legal contract or a binding representation and does not represent the views of Angus Council. Emails may be monitored for security and network management reasons. Messages
 containing inappropriate content may be intercepted. Angus Council does not accept any liability for any harm that may be caused to the recipient system or data on it by this message or any attachment.
</span><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:DA"><br>
<br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Qgis-user mailing list<o:p></o:p></pre>
<pre><a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><o:p></o:p></pre>
<pre>List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><o:p></o:p></pre>
<pre>Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:DA"><o:p> </o:p></span></p>
</div>
</body>
</html>