Focal Point
[SOLVED] How to make &Variables not required in ReportCaster (WF8)

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

February 18, 2017, 11:18 AM
a415
[SOLVED] How to make &Variables not required in ReportCaster (WF8)
Hello,

I had a report similar to this in WebFocus 7703 and, in ReportCaster, the variables we set up were optional and it would run with at least 1 variable populated.

When I moved the report to WebFocus 8009, ReportCaster is now giving me an error that "A VALUE IS MISSING FOR &VARIABLE". Here's an example:
  
SET NODATA = ' '

DEFINE FILE CAR
SHOW_RTL/D7 MISSING ON = IF RETAIL LT 5000 THEN RETAIL ELSE MISSING;
END

TABLE FILE CAR
PRINT
CAR
MODEL
RETAIL
SHOW_RTL
BY COUNTRY
WHERE ( (COUNTRY EQ '&COUNTRY') OR
        (CAR EQ '&CAR')
      )
END


In WF7 RC, If I put &COUNTRY = ITALY and left &CAR null, it would run with all output where COUNTRY = ITALY.

In WF8 RC, If I put &COUNTRY = ITALY and left & CAR null, I'd get this error:
quote:

BTP1020 Executing focexec.
BTP1020 Connection to the Reporting Server EDASERVE closed at 2017-02-18 08:07:01.159-0800 (1,487,434,021,159)
BTP1020 Job ran on the Reporting Server EDASERVE for 0.0080 seconds
BTP1020 Task error: A VALUE IS MISSING FOR: &CAR
BTP1010 No report to distribute.


How do I fix this in WF8009 using ReportCaster?

Thank you

This message has been edited. Last edited by: a415,


8009
Windows 7
Excel/HTML/AHTML/PDF
February 19, 2017, 03:41 PM
Waz
You could add defaults for the variables with -DEFAULTH.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

February 20, 2017, 09:03 AM
Avinash
You can use some pre process condition for variable-

-SET &CAR= (IF &CAR EQ '' OR &CAR EQ MISSING) THEN '_FOC_NULL' ELSE &CAR;


Thanks!
@vi

WebFOCUS 8105, Dev Studio 8105, Windows 7, ALL Outputs
February 20, 2017, 11:11 AM
j.gross
If &CAR is undefined,
-SET &CAR= (IF &CAR EQ '' OR &CAR EQ MISSING) THEN '_FOC_NULL' ELSE &CAR;

will trigger the same error message.

-DEFAULT &CAR='_FOC_NULL' 

at the top of the fex is necessary and sufficient.
February 23, 2017, 04:44 PM
a415
Thanks all! I will give those a try.

I appreciate it and will post an update of what worked before marking this solved.


8009
Windows 7
Excel/HTML/AHTML/PDF
February 23, 2017, 07:42 PM
a415
I used:
quote:
-DEFAULT &CAR='_FOC_NULL'


This worked for me using a report with about 13 variables. It's a template for monthly scheduled reports where one or more variables could be used, but not all.

Thank you all for your assistance!


8009
Windows 7
Excel/HTML/AHTML/PDF