The Number 1 independent website for ACL information!

TexasACL User Group
About Us
Training
Why ACL
Essays & Scripts
ACL News
Events
Links
FAQ
Site Map
Support Us
<meta name="GENERATOR"/><style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style> <p style="margin-bottom: 0in; page-break-before: always;"><font color="#000000"><font face="Arial, sans-serif"><font size="2">I don't like to use Global Variables because I believe it a best practice is to DELETE ALL OK when starting a script---using this convention, you would delete all variables at the start of the script.---this ensures that the script runs with only the values entered in the execution of the currently executed scripts. Thus, the use of global variables is negated.</font></font></font></p><p style="margin-bottom: 0in; page-break-before: always;"><br/></p><p style="margin-bottom: 0in; page-break-before: always;"><font color="#000000"><font face="Arial, sans-serif"><font size="2">At the same time, it is often valuable to have access to global variables. This is particularly true when using Dialog Boxes/interactive scripts. With Dialog Boxes you often want to capture the last values utilized in the execution of a script. For example, you may want ACL to recall the selection of the previous execution---thus, allowing the dialog boxes/interactive scripts to have default values equal to the previous usage.</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">We thus have two conflicting objectives. First, to ensure that the values captured in a script are pertinent and accurate for the current run of the script. Second, to enhance the effectiveness of interactive scripts. I've written a few scripts that make this a possibility. The first script, which would actually be one of the last scripts run in a project, creates a .fil that preserves the variable inputs from the project in a table called "Variable_Record". The other two scripts are actually run near the start of the project and interprets the values in the Variable_Record Table. </font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">In working with these scripts, I would initiate a dialog box or accept command that inquires of the user if they wish to load saved values. If the answer is yes, then it runs the script with those saved values.</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">NOTE: The next level of using this script, would be to create different VARIABLE_RECORD tables as permanent records for the selections used or to recreate prior selections! </font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">NOTE: This script is a proof of concept (it works in theory, but care should be observed as it hasn't been tested extensively.)</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">COM******************************</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">COM This script is intended to be one of the last scripts run in the execution of a</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">COM a project or it is intended to be run right after ALL of the dialog scripts</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">COM are run. (NOTE: Best practice is to have ALL dialog scripts execute before</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">COM running analysis scripts.)</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">COM******************************</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">SET SAFETY OFF</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">DEL test1.log OK</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">DEL test1.lix OK</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">DEL FORMAT variable_record OK</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">DELETE variable_record.fil OK</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">SET LOG test1</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">DIS VAR</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">SET LOG</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">IMPORT PRINT TO Temp1 "temp1.FIL" FROM "test1.LOG" SERVER 1 0 RECORD "Detail" 0 1 0 TEST 0 2 AT 1,1,1 0 "E" TEST 1 0 AT 1,1,0 0 "Log" TEST 1 0 AT 1,1,0 0 "Name" TEST 1 0 AT 1,1,0 7 "Switching" FIELD "full_record" C AT 1,1 SIZE 100,1 DEC 0 WID 88 PIC "" AS "" OPEN Temp1</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">OPEN TEMP1</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">DEFINE FIELD f_var_name COMPUTED SUBSTR(SPLIT(full_record, " ", 1), 1, 33)</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">DEFINE FIELD f_var_type COMPUTED sub(ALL(SUB(FULL_Record,at(1," ",Full_record),100)),1,1)</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">DEFINE FIELD f_var_value COMPUTED sub(ALL(SUB(FULL_Record,at(1," ",FULL_record),100)),at(1," ",ALL(SUB(FULL_Record,at(1," ",FULL_record),100))),100)</font></font></font><font color="#000000"><br/><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">EXTRACT f_var_name f_var_type F_var_value to "Variable_Record.fil"</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">************************************************************</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">************************************************************</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">*************E02_Variable_Assign*******************************</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">*************************************************************</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">*************************************************************</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">COM********************************************************</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">COM This script is control script that is run near the start of the project.</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">COM********************************************************</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">OPEN Variable_Record</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">COUNT</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">v_cntr = count1</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">v_cnt = 1</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">DO E03_Variable_Assign WHILE v_cnt <=V_cntr</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">************************************************************</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">************************************************************</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">*************E03_Variable_Assign*******************************</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">*************************************************************</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">*************************************************************</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">Open Variable_Record</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">Locate record %v_cnt%</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">Assign v_temp = ALL(exclude(f_var_name,'"'))</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">IF f_var_type ="C" Assign %v_temp% = ALL(exclude(f_var_value,'"'))</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">IF f_var_type ="D" Assign %v_temp% = f_var_value\</font></font></font><font color="#000000"><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">IF f_var_type ="N" Assign %v_temp% = VALUE(f_var_value,2)</font></font></font><font color="#000000"><br/><br/></font><font color="#000000"><font face="Arial, sans-serif"><font size="2">v_cnt = v_cnt +1</font></font></font><font color="#000000"> </font> </p> <p style="margin-bottom: 0in;"><br/><br/> </p> <p style="margin-bottom: 0in;"><br/> </p> </div> </div> </td> </tr> </tbody></table> </div> </td> </tr></table> </td> </tr> <tr> <td id="IWS_WH_Elem_Footer" colspan="2" class="MS_MasterFooter"> <div class="MSC_FooterFrame"> <span id="IWS_WH_Elem_FooterLinks"> </span> <div id="IWS_WH_Elem_FooterText" class="MSC_FooterText"> All rights reserved </div> </div> </td> </tr> <tr id="ctl00_IWS_WH_Elem_Logo"> <td id="ctl00_IWS_WH_Elem_BottomAd" class="MS_MasterBottomAD" style="padding-top:2px"> </td> </tr> </table> </form> <!-- BEGIN TRACKING CODE --> <script type="text/javascript" language="JavaScript"> var FCProAccountId = "12b55bbb-6f3c-470f-8051-1b5cece35e42"; var ServerName = "Texasacl-financial-officelive-com.sitereports.officelive.com"; </script> <script type="text/javascript" language="JavaScript" src="http://Texasacl-financial-officelive-com.sitereports.officelive.com/js/restats_static.js"> </script> <noscript> <img src="http://Texasacl-financial-officelive-com.sitereports.officelive.com/FCPISAPI/ISAPIExtn.dll/i/12b55bbb-6f3c-470f-8051-1b5cece35e42/0" /> </noscript> <!-- END TRACKING CODE --> <!-- CXNID=5426436&Code=C2 --> </body> </html>