Help!!!!!
Cannot get the hang of scripts..
Regular keystroke scripts that are memorized are no problem.
Let me illustrate my problem and maybe someone can help me...
I am trying to make a script that will be triggered by the entry into a field.
Field # 1 (N)is a number from 10 to 50.
Field # 2 (R)is a number from 1 to 10. (This is trigger.)
Field # 3 (displayN) is the result of first calculation.
Field # 4 (displayR) is the result of second calculation.
Field # 5 is a calculated field (displayN/displayR), the final answer....
I need to compute the combinations of N numbers taken R at a time.... Combinations ....
The formula is C(n,r)= N!
----------
R!*(N-R)!
Alpha 4 does not do factorial multiplication, so it has to be done mathematically, as follows:
set %result = N
set %counter = R
:A
%intresult = %result*%counter
%result = %intresult
%counter = %counter + 1
if %counter = N, goto :B
goto :A
:B fieldenter %result,displayN this gives N!/R!
set %result = (N-R)
set %counter = (N-R)
:C
%intresult = %result*%counter
%result = %intresult
loop :C, %counter
:D fieldenter %result,displayR
Final answer : C = displayN/displayR
Every time I try to write the script and get no errors at save, all that happens is that the screen shows all the text in the script two letters at a time in field # 2.
Every time I try to re-write the script with what I think is the proper syntax, I get "unrecognized script/macro command"....
Thanx to anyone who can help me
Dick Coleman
Cannot get the hang of scripts..
Regular keystroke scripts that are memorized are no problem.
Let me illustrate my problem and maybe someone can help me...
I am trying to make a script that will be triggered by the entry into a field.
Field # 1 (N)is a number from 10 to 50.
Field # 2 (R)is a number from 1 to 10. (This is trigger.)
Field # 3 (displayN) is the result of first calculation.
Field # 4 (displayR) is the result of second calculation.
Field # 5 is a calculated field (displayN/displayR), the final answer....
I need to compute the combinations of N numbers taken R at a time.... Combinations ....
The formula is C(n,r)= N!
----------
R!*(N-R)!
Alpha 4 does not do factorial multiplication, so it has to be done mathematically, as follows:
set %result = N
set %counter = R
:A
%intresult = %result*%counter
%result = %intresult
%counter = %counter + 1
if %counter = N, goto :B
goto :A
:B fieldenter %result,displayN this gives N!/R!
set %result = (N-R)
set %counter = (N-R)
:C
%intresult = %result*%counter
%result = %intresult
loop :C, %counter
:D fieldenter %result,displayR
Final answer : C = displayN/displayR
Every time I try to write the script and get no errors at save, all that happens is that the screen shows all the text in the script two letters at a time in field # 2.
Every time I try to re-write the script with what I think is the proper syntax, I get "unrecognized script/macro command"....
Thanx to anyone who can help me
Dick Coleman
Comment