Focal Point
Conditionally adding Conditions to report

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3821028331

December 30, 2004, 09:05 AM
thangam
Conditionally adding Conditions to report
Can I include where condition based on the user entered i/p?

WHERE ( DIR_ITEM_MSTR.PARNT_ITEM_F EQ 'Y' )
AND ( DIR_ITEM_MSTR.MRCH_PUBL_F EQ 'Y' )
AND ( ITEM_TYPE_MSTR.ITEM_TYPE_T EQ 'Sellable' )
AND ( CATG_TMPL_ATTR.STAT_C EQ 'R' )
AND (IF &DETAIL EQ 'ALL' THEN (CATG_HDR.CATG_I EQ &SpecifiedTemplate))
AND (ITEM_CATG.BUS_UNIT_C EQ &BusinessUnit)
AND (ITEM_TYPE_INFO.PUBL_DEST_C EQ &PublishDestination);

If detail is All, the I want to add filter criteria on CATG_I.

Can I do it?

Otherwise I may need to repeat the code by changing the where condition.
December 30, 2004, 02:45 PM
GCohen
I would do this the following way.

-IF &DETAIL NE 'ALL' THEN GOTO NEXT;
WHERE CATG_HDR.CATG_I EQ &SpecifiedTemplate)) ;
-NEXT
WHERE ...
December 31, 2004, 01:54 AM
thangam
-IF &Detail NE 'ALL' THEN GOTO -NEXT;
WHERE ( DIR_ITEM_MSTR.PARNT_ITEM_F EQ 'Y' )
AND ( DIR_ITEM_MSTR.MRCH_PUBL_F EQ 'Y' )
AND ( ITEM_TYPE_MSTR.ITEM_TYPE_T EQ 'Sellable' )
AND ( CATG_TMPL_ATTR.STAT_C EQ 'R' )
AND (ITEM_CATG.BUS_UNIT_C EQ &BusinessUnit)
AND (ITEM_TYPE_INFO.PUBL_DEST_C EQ &PublishDestination);

-NEXT
WHERE ( DIR_ITEM_MSTR.PARNT_ITEM_F EQ 'Y' )
AND ( DIR_ITEM_MSTR.MRCH_PUBL_F EQ 'Y' )
AND ( ITEM_TYPE_MSTR.ITEM_TYPE_T EQ 'Sellable' )
AND ( CATG_TMPL_ATTR.STAT_C EQ 'R' )
AND ( CATG_HDR.CATG_I EQ &SpecifiedTemplate)
AND (ITEM_CATG.BUS_UNIT_C EQ &BusinessUnit)
AND (ITEM_TYPE_INFO.PUBL_DEST_C EQ &PublishDestination);


This is what I tried. But I receive the following error message "0 ERROR AT OR NEAR LINE 307 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC281) ALPHA ARGUMENTS IN PLACE WHERE NUMERIC ARE CALLED FOR"


After applying conditional where, I want to execute the remaining statement like formatting, etc.

Guide me how can I do it?
December 31, 2004, 02:19 AM
Leah
I'm not sure what is giving the numeric error to you however, what version of FOCUS are you using, In our WebF 4.3.6 the length of amper variables names is limited to 12 and I noticed you have a longer one if I am counting correctly.
December 31, 2004, 07:13 AM
thangam
Got it fixed.

Syntax what I was using in the previous code was incorrect.