<?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: Script Calculating Fields to Populate Another Field in ArcPad 10 in ArcPad Questions</title>
    <link>https://community.esri.com/t5/arcpad-questions/script-calculating-fields-to-populate-another/m-p/485328#M3510</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;I don't have a complete answer for you, and unfortunately don't have a lot of time to spend on this today, but I'll try to give you some suggestions on how I've done something similar in the past.&amp;nbsp; I can't tell you how to do it using ArcPad Studio since I typically have just edited my files directly (done before the current versions of ArcPad Studio).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a subroutine to create the feature (point for this example) which calls a variety of of suboroutines to, eg, grab attributes from a polygon layer, etc., and then call my PopulateCommonFields ..which is more or less the GPS attributes, and the my PopulateUniqueFields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my PopulateUniqueFields subroutine, I use "Case" to check to see what layer it is, then based on this, it will do different calculations and then populate the fields.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I make use of&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newVariable = Application.UserProperties("&amp;lt;ItemName")&lt;/P&gt;&lt;P&gt;...do may calculations with my newVariableto calculate myResult&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ObjRS.Fields.Item("&amp;lt;ItemName").value = myResult&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not calculated and populated a Form with the result if the form is already open, but I have saved/retrieved variables, and then used it to populate a new form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;re: #2 - I keep all my scripts in multiple .vbs files to keep them a bit more organized, and call them all in my .vbs at the end of my .apa file.&amp;nbsp; The subroutines can go in any of those .vbs files, as long as the environment (variables, etc) is set as needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry that this isn't really an answer, but maybe this can jump start some things to look into. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Aug 2015 18:02:10 GMT</pubDate>
    <dc:creator>RebeccaStrauch__GISP</dc:creator>
    <dc:date>2015-08-11T18:02:10Z</dc:date>
    <item>
      <title>Script Calculating Fields to Populate Another Field in ArcPad 10</title>
      <link>https://community.esri.com/t5/arcpad-questions/script-calculating-fields-to-populate-another/m-p/485327#M3509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently using ArcPad to collect field data. I have had several requests of things to figure out with ArcPad and most of them I have figured out and have working great. One request is to populate a field using a script that calculates a formula A-B/ Length * 100. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub SumFunction&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; Dim objControl, objForm, Cul_Length, D_DSCt_DSI, riff_ele, WC_Slope, US_In_ele &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objControl = ThisEvent.Object &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objForm = ThisEvent.Object.Parent&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; riff_ele = objControl.Value&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WC_Slope = objForm.Controls("txtUS_In_ele").Value - riff_ele / (Cul_Length + D_DSCt_DSI) * 100 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objForm.Controls("txtWC_Slope").Value = WC_Slope&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I am not sure if this script is correct even though it validates ( I am not a programmer but I have studied it a little).&lt;/P&gt;&lt;P&gt;2. Where in ArcPad Studio would I place the script? There are several events to choose from but I am not sure what one I should use. &lt;/P&gt;&lt;P&gt;3. Will this fill in while the form is open or would it need to close and open back up. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone has suggestions on how to get this to work it would be much appreciated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2015 17:11:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/script-calculating-fields-to-populate-another/m-p/485327#M3509</guid>
      <dc:creator>BrianBower1</dc:creator>
      <dc:date>2015-08-11T17:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Script Calculating Fields to Populate Another Field in ArcPad 10</title>
      <link>https://community.esri.com/t5/arcpad-questions/script-calculating-fields-to-populate-another/m-p/485328#M3510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;I don't have a complete answer for you, and unfortunately don't have a lot of time to spend on this today, but I'll try to give you some suggestions on how I've done something similar in the past.&amp;nbsp; I can't tell you how to do it using ArcPad Studio since I typically have just edited my files directly (done before the current versions of ArcPad Studio).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a subroutine to create the feature (point for this example) which calls a variety of of suboroutines to, eg, grab attributes from a polygon layer, etc., and then call my PopulateCommonFields ..which is more or less the GPS attributes, and the my PopulateUniqueFields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my PopulateUniqueFields subroutine, I use "Case" to check to see what layer it is, then based on this, it will do different calculations and then populate the fields.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I make use of&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newVariable = Application.UserProperties("&amp;lt;ItemName")&lt;/P&gt;&lt;P&gt;...do may calculations with my newVariableto calculate myResult&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ObjRS.Fields.Item("&amp;lt;ItemName").value = myResult&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not calculated and populated a Form with the result if the form is already open, but I have saved/retrieved variables, and then used it to populate a new form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;re: #2 - I keep all my scripts in multiple .vbs files to keep them a bit more organized, and call them all in my .vbs at the end of my .apa file.&amp;nbsp; The subroutines can go in any of those .vbs files, as long as the environment (variables, etc) is set as needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry that this isn't really an answer, but maybe this can jump start some things to look into. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2015 18:02:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/script-calculating-fields-to-populate-another/m-p/485328#M3510</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2015-08-11T18:02:10Z</dc:date>
    </item>
  </channel>
</rss>

