option Field

hi,

i have an option field with options 1,2,3,4,5 and i have 10 textboxes which are bounded with global variable…

when i select the option as 1 and click a button the first two boxes are generated with a date difference of one month …similarly when i select the option as 2 and click a button the first four textboxes are generated with a date difference for ex

let the date be 02/02/02 and option is 1 then textboxes will range from 04/04/02-05/04/02

option is 2 then 04/04/02-05/04/02, 05/04/02-06/04/02

we are getting this by using case …

but once if i select 2 and again select 1

then also all 4 textboxes are enabling so i want only two textboxes …to be enabled…

I am pasting the code…

CASE “Cycle Number” OF
“Cycle Number”::“1”:
BEGIN
glbrecpay11:=“Start Date”;
glbrecpay12:=CALCDATE(‘1M’,glbrecpay11);
END ;
“Cycle Number”::“2”:
BEGIN
glbrecpay11:=“Start Date”;
glbrecpay12:=CALCDATE(‘1M’,glbrecpay11);
glbrecpay21:=glbrecpay12;
glbrecpay22:=CALCDATE(‘1M’,glbrecpay21);
END ;
END;

Hi Bavani,

When you select option 2 and then option 1 there is nothing to clear the glbrecpay21 & glbrecpay22 variables. use a CLEAR command or assignment i.e. glbrecpay21:= 0D;

thank you dave it is working

but it is becoming a big code …i am using for 12 options…is there any other option…let me know…

i am posting…

for ex::
CASE “Cycle Number” OF
“Cycle Number”::“1”:
BEGIN
glbrecpay11:=“Start Date”;
glbrecpay12:=CALCDATE(‘1M’,glbrecpay11);
glbrecpay21:=0D;
glbrecpay22:=0D ;
glbrecpay31:=0D;
glbrecpay32:=0D;
glbrecpay41:=0D;
glbrecpay42:=0D;
glbrecpay51:=0D;
glbrecpay52:=0D ;
glbrecpay61:=0D;
glbrecpay62:=0D;
glbrecpay71:=0D;
glbrecpay72:=0D;
glbrecpay81:=0D;
glbrecpay82:=0D;
glbrecpay91:=0D;
glbrecpay92:=0D;
glbrecpay101:=0D;
glbrecpay102:=0D;
glbrecpay111:=0D;
glbrecpay112:=0D;
glbrecpay121:=0D;
glbrecpay122:=0D;
END ;
“Cycle Number”::“2”:
BEGIN
glbrecpay11:=“Start Date”;
glbrecpay12:=CALCDATE(‘1M’,glbrecpay11);
glbrecpay21:=glbrecpay12;
glbrecpay22:=CALCDATE(‘1M’,glbrecpay21);
glbrecpay31:=0D;
glbrecpay32:=0D;
glbrecpay41:=0D;
glbrecpay42:=0D;
glbrecpay51:=0D;
glbrecpay52:=0D ;
glbrecpay61:=0D;
glbrecpay62:=0D;
glbrecpay71:=0D;
glbrecpay72:=0D;
glbrecpay81:=0D;
glbrecpay82:=0D;
glbrecpay91:=0D;
glbrecpay92:=0D;
glbrecpay101:=0D;
glbrecpay102:=0D;
glbrecpay111:=0D;
glbrecpay112:=0D;
glbrecpay121:=0D;
glbrecpay122:=0D;

END;
“Cycle Number”::“3”:
BEGIN
glbrecpay11:=“Start Date”;
glbrecpay12:=CALCDATE(‘1M’,glbrecpay11);
glbrecpay21:=glbrecpay12;
glbrecpay22:=CALCDATE(‘1M’,glbrecpay21);
glbrecpay31:=glbrecpay22;
glbrecpay32:=CALCDATE(‘1M’,glbrecpay31);
glbrecpay41:=0D;
glbrecpay42:=0D;
glbrecpay51:=0D;
glbrecpay52:=0D ;
glbrecpay61:=0D;
glbrecpay62:=0D;
glbrecpay71:=0D;
glbrecpay72:=0D;
glbrecpay81:=0D;
glbrecpay82:=0D;
glbrecpay91:=0D;
glbrecpay92:=0D;
glbrecpay101:=0D;
glbrecpay102:=0D;
glbrecpay111:=0D;
glbrecpay112:=0D;
glbrecpay121:=0D;
glbrecpay122:=0D;

i have a field called cyclenumber is of integer type…depending upon the cyclenumber i have to calculate date .

for ex::cyclenumber is 2 then the date should be 2 * ‘1M’…so the output should be of 60 days…

CALCDATE('cyclenumber*‘1M’,startdate);

i am getting an error

please guide me

Hi Bavani,

First question: I would us an array

Second question: CALCDATE requires a text string try

CALCDATE( format(cyclenumber)+‘M’, startdate );

Hi dave,

i got the solution for 2nd Question…Thank You…

Im not not clear how to use array here…I think i have to use 2 dimensional array…

Can u help me out…

You use an array with two dimensions like this VariableName[Dim1,Dim2]

Then you can put it into any statement like this

FOR i := 1 TO 10 DO
FOR j := 1 TO 10 DO
VariableName[i,j] := i * j; { or whatever }