I have a table which has 7 flags. Each row in that table has a key value and each row will have only one of teh flags turned on
so, if I query by the PK of that table, I will see one and only one flag ON. Based on the flag which is ON, I will know which table to query from for generating my report.
Now, can any one tell me how do i implement my top IF condition? Can I read that flag into a local variable and say like
IF FLAG1 = 'Y' THEN
TABLE FILE MASTER1 ... END ELSE IF FLAG2 = 'Y' THEN TABLE FILE MASTER2 ... END ELSE IF FLAG3 ='Y' THEN TABLE FILE MASTER3 ... END END
June 09, 2006, 02:54 AM
Mikel
Two reports, first to retrieve Master name (using a defined field with your IF condition) and second to generate your report (I'm supposing the structure of differents tables are the same)
-* Define MASTER in function of flags.
DEFINE FILE ptable
MASTER/A64 =
IF FLAG1 EQ 'Y' THEN 'MASTER1' ELSE
IF FLAG2 EQ 'Y' THEN 'MASTER2' ELSE
...
ELSE '?' ;
END
-* Report to retrieve MASTER.
TABLE FILE ptable
PRINT MASTER
WHERE PK ...
ON TABLE HOLD FORMAT ALPHA
END
-RUN
-* Read MASTER name.
-DEFAULT &MASTER = '?' ;
-READ HOLD &MASTER.A64.
-TYPE MASTER = &MASTER
-IF &MASTER EQ '?' THEN GOTO ... ;
-* Depending structures, we can use
-* -INCLUDE &MASTER or EX &MASTER or complex IF THEN GOTO
-* Final report
TABLE FILE &MASTER
...
END
-RUN
Regards, MikelThis message has been edited. Last edited by: Mikel,