<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Pre-Populating Fields with system info (Username and Date) in ArcPad Questions</title>
    <link>https://community.esri.com/t5/arcpad-questions/pre-populating-fields-with-system-info-username/m-p/160031#M1130</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply Hannah. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have already looked into The Quick Fields. It is a great way to add updates to new features created within ArcPad. However, it does not serve the purpose to pre-populate these fields on a feature edit rather than just creating new features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All that being said I did figure out the code and will paste it below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sub SetDateCPU&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT] Dim pCtrl1, pPages1, MyDate, pCtrl2, objNetwork, cpuName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pPages1 = ThisEvent.Object.Pages("PAGE1")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pCtrl1 = pPages1.Controls("MY_DATE") ' Your Date field here&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ' **If the below field is a text field the following works - if it's a date field just call Now()**&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyDate = MONTH(Date())&amp;amp;"/"&amp;amp; DAY(Date())&amp;amp;"/"&amp;amp; YEAR(Date())&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pCtrl1.Value = MyDate&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pCtrl2 = pPages1.Controls("USERNAME") ' Your username Field Here&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set objNetwork = CreateObject("WScript.Network")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; UName = objNetwork.UserName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pCtrl2.Value = UName[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course you don't need the subs if you don't put it into a VB. I dropped this into a "onLoad" action of the edit form. Works like a champ!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Note**&lt;/STRONG&gt;&lt;SPAN&gt; this calls the Microsoft WScript Object exe, so there's Windows environment variables that you could call into the script (Domain, CPU Name, IPaddress, etc...)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Jan 2014 15:18:17 GMT</pubDate>
    <dc:creator>MicahWilliamson</dc:creator>
    <dc:date>2014-01-27T15:18:17Z</dc:date>
    <item>
      <title>Pre-Populating Fields with system info (Username and Date)</title>
      <link>https://community.esri.com/t5/arcpad-questions/pre-populating-fields-with-system-info-username/m-p/160029#M1128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Greetings all:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using VBScript to pre-populate a few fields of a point shapefile whether they are new, or edited By a user. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an edit form and one page with two fields (trying to keep it simple while I get it working).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using the onload event of the edit form, I'm adding this VB:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim objNetwork&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim userName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim MyDate&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set objNetwork = CreateObject("WScript.Network")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;userName = objNetwork.UserName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MyDate = Now()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ThisEvent.Object.pages("PAGE1").controls("USER").Value = userName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ThisEvent.Object.pages("PAGE1").controls("DATE").Value = MyDate&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This populates the USER box with the user's login name, (works great). But it does not populate the DATE field with anything&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Infact i get an "Object not Defined" error for that line 8. if I swap the last two lines the DATE field gets populated but the USER field does not. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This leads me to assume it must be some limitation with the VB that cannot populate two boxes on the same event....?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I tried putting similar code onto the PAGE1 'onload' event but could not figure out the call. In fact I tried to make it very simple and just pre-populate the field with a fake user name text string: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ThisEvent.Object.controls("USER").Value = "Frank"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;None of them work, no error just doesn't work. I'm at a loss. Arcpad's help documentation is for 10.0 and doesn't really help put the pieces together anyway.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jan 2014 20:30:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/pre-populating-fields-with-system-info-username/m-p/160029#M1128</guid>
      <dc:creator>MicahWilliamson</dc:creator>
      <dc:date>2014-01-06T20:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Pre-Populating Fields with system info (Username and Date)</title>
      <link>https://community.esri.com/t5/arcpad-questions/pre-populating-fields-with-system-info-username/m-p/160030#M1129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Micah,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This was such a common request from ArcPad Users that ArcPad 10.2 now includes a new feature called &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/arcpad/10.2/app/index.html#/What_are_Quick_Fields/00s100000154000000/" rel="nofollow" target="_blank"&gt;Quick Fields&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The idea behind Quick Fields is that you can select your own 'rules' using the ArcPad &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/arcpad/10.2/app/index.html#/What_is_Expression_Builder/00s10000014v000000/" rel="nofollow" target="_blank"&gt; Expression Builder&lt;/A&gt;&lt;SPAN&gt; to populate your fields when you create new features. You can choose from the date and time, x and y coordinates, incremental ID's, names and much more. You simply select the field name you want to apply the rule to, then select the value from the drop-down list (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/arcpad/10.2/app/index.html#/Customize_Expression_Builder/00s100000157000000/" rel="nofollow" target="_blank"&gt;or even write your own&lt;/A&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Simply follow &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/arcpad/10.2/app/index.html#/What_is_Expression_Builder/00s10000014v000000/" rel="nofollow" target="_blank"&gt;these instructions &lt;/A&gt;&lt;SPAN&gt;to build your first Quick Fields Expression!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me if you need anything more,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hannah &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 00:57:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/pre-populating-fields-with-system-info-username/m-p/160030#M1129</guid>
      <dc:creator>HannahFerrier</dc:creator>
      <dc:date>2014-01-22T00:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Pre-Populating Fields with system info (Username and Date)</title>
      <link>https://community.esri.com/t5/arcpad-questions/pre-populating-fields-with-system-info-username/m-p/160031#M1130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply Hannah. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have already looked into The Quick Fields. It is a great way to add updates to new features created within ArcPad. However, it does not serve the purpose to pre-populate these fields on a feature edit rather than just creating new features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All that being said I did figure out the code and will paste it below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sub SetDateCPU&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT] Dim pCtrl1, pPages1, MyDate, pCtrl2, objNetwork, cpuName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pPages1 = ThisEvent.Object.Pages("PAGE1")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pCtrl1 = pPages1.Controls("MY_DATE") ' Your Date field here&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ' **If the below field is a text field the following works - if it's a date field just call Now()**&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyDate = MONTH(Date())&amp;amp;"/"&amp;amp; DAY(Date())&amp;amp;"/"&amp;amp; YEAR(Date())&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pCtrl1.Value = MyDate&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pCtrl2 = pPages1.Controls("USERNAME") ' Your username Field Here&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set objNetwork = CreateObject("WScript.Network")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; UName = objNetwork.UserName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pCtrl2.Value = UName[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course you don't need the subs if you don't put it into a VB. I dropped this into a "onLoad" action of the edit form. Works like a champ!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Note**&lt;/STRONG&gt;&lt;SPAN&gt; this calls the Microsoft WScript Object exe, so there's Windows environment variables that you could call into the script (Domain, CPU Name, IPaddress, etc...)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jan 2014 15:18:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/pre-populating-fields-with-system-info-username/m-p/160031#M1130</guid>
      <dc:creator>MicahWilliamson</dc:creator>
      <dc:date>2014-01-27T15:18:17Z</dc:date>
    </item>
  </channel>
</rss>

