<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>On 8/22/17 3:36 PM, McDonaldR wrote:<br>
    </p>
    <blockquote type="cite"
cite="mid:7CCEF44D1C42854999B19B1EB27281F6835AA333@SR2ORBHQ2K803.angus.gov.uk">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@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:"Century Gothic";
        panose-1:2 11 5 2 2 2 2 2 2 4;}
@font-face
        {font-family:"Franklin Gothic Book";
        panose-1:2 11 5 3 2 1 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        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;}
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";
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
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;}
.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]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D">Thanks
            Karl-Magnus<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></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.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></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"
              moz-do-not-send="true">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></p>
      </div>
    </blockquote>
    Great idea,<br>
    I'd love to introduce an "also apply on update" checkbox to default
    values, I think that would extremely improve the possibilities of
    this feature (last modified timestamp with `now()`, last modified by
    with a username variable etc.)<br>
    <br>
    Matthias<br>
    <blockquote type="cite"
cite="mid:7CCEF44D1C42854999B19B1EB27281F6835AA333@SR2ORBHQ2K803.angus.gov.uk">
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Ross<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><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
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB"
                  lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:EN-GB"
                lang="EN-US"> Karl Magnus Jönsson
                [<a class="moz-txt-link-freetext" 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 class="moz-txt-link-abbreviated" 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<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><a name="T_Default_Reply"
            moz-do-not-send="true"><span style="color:#1F497D" lang="SV">Hi!</span></a><span
            style="color:#1F497D" lang="SV"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">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.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <div>
          <p class="MsoNormal"><b><span
                style="font-size:10.0pt;font-family:"Franklin
                Gothic
                Book","sans-serif";color:black;mso-fareast-language:SV"
                lang="SV">Karl-Magnus
              </span></b><span
              style="font-size:10.0pt;font-family:"Franklin Gothic
Book","sans-serif";color:black;mso-fareast-language:SV"
              lang="SV"><o:p></o:p></span></p>
        </div>
        <p class="MsoNormal"><span style="color:#1F497D" lang="SV"><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
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:SV"
                  lang="SV">Från:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:SV"
                lang="SV"> Qgis-user [<a
                  href="mailto:qgis-user-bounces@lists.osgeo.org"
                  moz-do-not-send="true">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"
                  moz-do-not-send="true">qgis-user@lists.osgeo.org</a><br>
                <b>Ämne:</b> [Qgis-user] Updating a field set with
                default global variable on edit<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><span lang="SV"><o:p> </o:p></span></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)?<o:p></o:p></span></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.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="background:white"><o:p> </o:p></span></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;font-family:"Century
Gothic","sans-serif";color:#4F6228;mso-fareast-language:EN-GB">Ross
              McDonald |
            </span></b><span
            style="font-size:10.0pt;font-family:"Century
Gothic","sans-serif";color:#4F6228;mso-fareast-language:EN-GB">GIS
            Data Coordinator | Angus Council, People, IT | Angus House,
            Orchardbank Business Park, Sylvie Way, Forfar DD8 1AT<b> |
              t: 01307 476419<o:p></o:p></b></span></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:"Times New
              Roman","serif";mso-fareast-language:SV"> <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>
      </div>
      <div> </div>
      <div>
        <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span
            style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'Arial','sans-serif';
            mso-bidi-font-size: 8.0pt; mso-bidi-font-family: 'Times New
            Roman'"><font size="2">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.<span style="mso-spacerun: yes">
              </span>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.
            </font></span></p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></pre>
    </blockquote>
    <br>
  </body>
</html>