3 Replies Latest reply on Apr 27, 2013 3:32 PM by philmodjunk

    Using Global Fields To Provide Summary Number



      Using Global Fields To Provide Summary Number


           Using FM 10 Pro Advanced; Windows 7 64-bit Professional SP 1

           In my video database I have a field indicating DVD format (HSVIDEO::QBurn2) which can contain one of 4 text values:  "1RW", "2R" or "3RDL" as well as "0No".  All records have the default value of "0No".

           I have a script that performs 3 separate finds for the above first 3 values.

           I created 4 global fields (Burn2_1RW, Burn2_2R, Burn2_3RDL and Burn2_TTL)

           The script first sets the values of these global fields to zero.  I then perform the first find on field QBurn2="1RW" and have the script store the resulting (Get(FoundCount) to the global field Burn2_1RW.

           I then run the second find for field Qburn2 equal to "2R" then store the Get(FoundCount) in global field Burn2_2R.

           The third find searches for value in Q2_Burn2="3RDL", then store the Get(FoundCount) in global field Burn2_3RDL

           The final step of the script is to do a calculation and store the results in global field Burn2_TTL.  I have the script do a calc to add up the values stored in the first 3 global fields (Burn2_1RW+Burn2_2R+Burn2_3RDL).

           On the results layout, I have all 4 global fields and the values and calculations are correct.  Now that I have that in place and it runs correctly, I would like to post just the value in global field Burn2_TTL on my Main Menu screen.

           So next I duplicated this script and remarked out showing the layout form that displays the global field values/results.

           I have a MainMenu script run which now calls the duplicated script with the global field layout steps remarked out.  I am just wanting to run the finds and get the calculated total stored in global field Burn2_TTL.

           On the MainMenu layout I have that one Burn2_TTL field there with a label indicating total jobs burn.  The number is not correct.  It appears to be showing the previous Burn2_TTL value.  But if Irun the original script that displays the global fields layout, the values are correct, THEN if I re-run the MainMenu script, the summary total values of the global field Burn2_TTL is now correct.

           I have even tried in the MainMenu script run the original script that for an instant displays the global field layout form then displays the MainMenu layout but the number does not update.  It only updates the value in the global field Burn2_TTL on the MainMenu layout if I run the original script that displays the global fields layout form, then click on the button to run the MainMenu script.

           Example for further clarification:  If I run the script and the TTL global value is 5 (sum of the first three global field values), then run the MainMenu, the Burn2_TTL global field box on the MainMenu layout will correclty show the value of 5.

           But if I display a few records and update the Q2_Burn2 text field say from "0No" to "1RW" or "2R" or "3RDL" and run the original script, the Burn2TTL value on the global fields layout form correctly now shows, say, the number 8.

           If I run the MainMenu script off a button on that global layout form at that point, when the MainMenu comes up, the Burn2j_TTL field on that form still shows the previous calc result of 5.  I have to re-run the original script which takes me to the global layout form with the current number of 8 for the Burn2TTL global field, THEN run the MainMenu script, and the same global field on the MainMenu layout, Burn2TTL will now correctly show the value 8.