Focal Point
[SOLVED] Is it possible to evaluate for missing parameter in WF report?

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

June 23, 2009, 02:25 PM
ta2007
[SOLVED] Is it possible to evaluate for missing parameter in WF report?
What would be the correct syntax in order to output 'none selected' when input text box on launch page contains no entered data or word NULL, output 'ALL' when 'all' typed into the input box or the specific unit number if entered?

BTW launch page designed to pass values through xml containers.

Consider the following:

-SET &UNIT_HDR = IF &UNIT_NO IS MISSING THEN 'None Selected' ELSE
- IF UPCASE(4, &UNIT_NO, 'A4') EQ 'NULL' THEN 'POTATO VALU' ELSE
- IF UPCASE(3, &UNIT_NO, 'A3') EQ 'ALL' THEN 'ALL' ELSE &UNIT_NO;

Entering nothing in the corresponding field on the launch page produces 'None Selected', as does a space character. As a test, when entering Null in the unit no input box on the launch page, I expected to see a header with words 'Potato Valu'. Instead, it also returned 'None Selected'. Entering a specific unit number also resulted in 'none Selected'.

Data received from report source looked like this:

-SET &UNIT_HDR = IF NULL IS MISSING THEN 'None Selected' ELSE
- IF UPCASE(4, NULL, 'A4') EQ 'NULL' THEN 'POTATO VALU' ELSE
- IF UPCASE(3, NULL, 'A3') EQ 'ALL' THEN 'ALL' ELSE NULL;

Is there a better way to do parameter evaluation?

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


7.6.4
XP SP3
EXL2K, HTML, PDF
June 23, 2009, 02:48 PM
Francis Mariani
IS MISSING is incorrect syntax for Dialogue Manager. To determine the existence of a Dialogue Manager variable, use the EXIST suffix:

IF &UNIT_NO.EXIST EQ 0

See documentation: Developing Reporting Applications > Managing Flow of Control in an Application > Customizing a Procedure With Variables > Screening a Variable Value.

The whole Dialogue Manager IF statement gets evaluated, so, unfortunately, when EXIST is used in a complex IF statement, and the variable does not exist, the IF statement fails with an error.

Instead, and it makes life easier, add a default setting in the program. e.g.:

-DEFAULT &UNIT_NO = '';

-SET &UNIT_HDR = IF &UNIT_NO EQ '' THEN 'None Selected' ELSE
- IF UPCASE(4, &UNIT_NO, 'A4') EQ 'NULL' THEN 'POTATO VALU' ELSE
- IF UPCASE(3, &UNIT_NO, 'A3') EQ 'ALL' THEN 'ALL' ELSE &UNIT_NO;

-TYPE &UNIT_HDR



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 23, 2009, 02:48 PM
Darin Lee
IS MISSING will not work. If no value is passed then the value is blank, not NULL. Also, your further tests are not testing your variable - they are testing NULL. Try this:
-SET &UNIT_HDR=IF &UNIT_NO EQ '' THEN 'None Selected' ELSE
-IF &UNIT_NO EQ 'NULL' THEN 'POTATO VALU' ELSE &UNIT_NO ;


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
June 23, 2009, 03:23 PM
ta2007
Francis,

Your default approach worked. I had a default statement written in the code too, but I was trying to evaluate against 'NULL'. I think I was creating conflicts by doing that. Appeared to me like it was ignoring the default value, which had me thinking that there was some special hidden value coming in. Anyway, using the '' was a much easier and simplier solution and the code snippet now works as desired. THANKS!

Darin, if user entered criteria of ALL in input box, I wanted the header to specifically reflect their choice of "ALL". That said, you are technically right. In a later line of code all three of these criteria ('', NULL, ALL) send NULL to the pipeline query.


7.6.4
XP SP3
EXL2K, HTML, PDF
June 23, 2009, 03:26 PM
ta2007
Francis,

Thank you also for the tech guide tip. Sometimes, finding the help in the documentation is a challenge in and of itself. Smiler


7.6.4
XP SP3
EXL2K, HTML, PDF
June 23, 2009, 04:13 PM
Francis Mariani
Don't forget
quote:
IS MISSING is incorrect syntax for Dialogue Manager. To determine the existence of a Dialogue Manager variable, use the EXIST suffix:

IF &UNIT_NO.EXIST EQ 0



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 23, 2009, 04:28 PM
susannah
i find it xplatform safer to say something like this:
-SET &myparmexist = &myparm.exist ;
-GOTO fix.&myparmexist ;
-fix.0
-SET &myparm = 'YOU FORGOT';
-fix.1




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID