Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Including a counter in a script ?

Status
Not open for further replies.

wazza99

Technical User
May 29, 2003
18
0
0
GB
I would like to include a counter in a script so i can measure how many times a call has, for example had a message played, so that if it has had it 4 times i can route off somewhere else. Can't for the life in me find what command i would use. I can guess i need a call variable starting at zero, but what command would make it increase by 1 each time ??
 
There are a number ways and as you have said you need to create a call variable with a value in it, something like this: call variable loop_count with a value of 4

SECTION loop

ASSGIGN loop_count - 1 TO loop_count /* this deducts 1 from 4 */

IF loop_count = 0 THEN

ROUTE CALL xxxxxx

END IF

do your normal holding loop stuff here

EXECUTE loop


This will execute the loop until the loop_count call variable reaches 0, the call will then route away.
 
Thanks for that but i can't get this to validate i get..

Line: 3 Position: 19 Code: 55 Error: Invalid type (left-hand-side) in Subtraction operation.
Line: 3 Position: 1 Code: 92 Error: Incompatible types in assignment statement.

Any more ideas ?
 
I always do it the other way.

ASSIGN 0 TO loop_count_cv

SECTION loop
ASSIGN (loop_count_cv + 1) TO loop_count_cv

IF loop_count = 4 THEN
ROUTE CALL xxxxxx
END IF

do your normal holding loop stuff here

EXECUTE loop

Again, you must have an Integer call variable named loop_count_cv (or whatever you want to call it) with a value in it. It doesn't really matter what value you put in because you are changing it to what you want when you do the ASSIGN command.

Hope that helps!
 
Thanks sorted now, the variable i created was DN changed it to integer now works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top