This is a very basic request for help but after searching and attempting to define a simple counter is proving to be a wasted effort therefore I am seeking guidance from this community. I have a 'For Each...' command in a program and it is looping through just as it should; however, for testing purposes, I want a message to appear every time the program completes a loop - so far, this much works. What I cannot seem to do is add a variable that can count/increment the number of loops. I have tried adding this simple variable (count=count+1) but I can find no means to add it. The user guide shows an example like this:
For Each Record from [$rset]
Simple Math: [FieldA]=[FieldA]+1
It looks deceptively simply but I am having zero success in adding this variable. How can I add this 'Simple Math'? I have seriously attempted all options in the 'Script Designer' for 'Add Variable' that I can find and I cannot even add '1' to a number. Please help...
Assuming you have created a global "maths" variable call count and placed it inside the loop , it should be possible to display this variable with a "calculated mathematical" field on a form - may need to add a "refresh field" action at end of script to update display.
What/where is this "calculated mathematical" field that you mention? I do not need to have this appear on a form, I just want to script to count the number of times the program loops based on the "For Next...' statement. The code in my problem is not any different than I posted in my example. All I need to know is how to simply add a counter (count=count+1). I can 'almost' create the variable, the issue is I cannot find a way to just add one to that variable. The counter should appear in the script but how does a person add a basic math formula to the script??? Nothing I tried would allow this.
Please do not read too much into this question because it IS as basic as it appears... I need to add a value of 1 to a variable. I saw many example in the user's guide that involve these basic math functions (+,-,*, and /) but I cannot find where to create the formula. Presumably, I would go to the 'Script Designer', click 'Add Variable' (this would be in between the 'For Each... and Next' statements. Then, on the 'Enter the variable name', click 'Ok', on the 'Set Var by Math Formula' field select the 'Formula to Use' field, and add the simply formula but nothing is there for the basic math functions.
Yes, you are right!!! That simple code is exactly what I was asking about. Unfortunately, I cannot open the file you attached (it shows an error of 'Unknown Format'). How/where did you go to add line 4 of your code? I know that this sounds too simply but I cannot find any means to add a simple line like [count]=[count]+1.
As always, I certainly appreciate your help.
Okay... I finally was able to make it work. That proved to be an extremely difficult endeavor for such a simple task. I would have thought that there was a much easier way (i.e., more straightforward) than what was actually required.