LeonelSanchezJr
Programmer
I have built "WHERE" clauses for direct SQL passthrus, but this one is slightly different.
I have 3 parameter fields which can either all be populated or only one or two.
My code goes like this:
-SET &M_WHERE1= IF '&ORG.EVAL' EQ ' ' THEN ' '
- ELSE ' S.ORIGINLOCATIONCODE = ''&ORG''';
-SET &M_WHERE2= IF '&DST.EVAL' EQ ' ' THEN ' '
- ELSE ' S.DESTINATIONLOCATIONCODE = ''&DST''';
-SET &M_WHERE3= IF '&APPT.EVAL' EQ 'N' OR 'n' THEN ' '
- ELSE ' SE.ADDEDDATE IS NOT NULL ';
-SET &M_WHERE = IF &M_WHERE1.EVAL NE ' ' THEN &M_WHERE1
- ELSE '' ;
-SET &M_WHERE = IF &M_WHERE.EVAL NE ' ' THEN IF &M_WHERE2.EVAL NE ' ' THEN &M_WHERE | ' AND ' + | &M_WHERE2
- ELSE &M_WHERE ;
Thanks,
Leo ;-)
I have 3 parameter fields which can either all be populated or only one or two.
My code goes like this:
-SET &M_WHERE1= IF '&ORG.EVAL' EQ ' ' THEN ' '
- ELSE ' S.ORIGINLOCATIONCODE = ''&ORG''';
-SET &M_WHERE2= IF '&DST.EVAL' EQ ' ' THEN ' '
- ELSE ' S.DESTINATIONLOCATIONCODE = ''&DST''';
-SET &M_WHERE3= IF '&APPT.EVAL' EQ 'N' OR 'n' THEN ' '
- ELSE ' SE.ADDEDDATE IS NOT NULL ';
-SET &M_WHERE = IF &M_WHERE1.EVAL NE ' ' THEN &M_WHERE1
- ELSE '' ;
-SET &M_WHERE = IF &M_WHERE.EVAL NE ' ' THEN IF &M_WHERE2.EVAL NE ' ' THEN &M_WHERE | ' AND ' + | &M_WHERE2
- ELSE &M_WHERE ;
Thanks,
Leo ;-)