Focal Point
RESOLVED-Setting Parameters in Headings

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

April 18, 2016, 10:09 AM
JulieA
RESOLVED-Setting Parameters in Headings
Q. How can I eliminate the Systemwide reference in my heading when only a store name is selected by a user?

We’re trying to set the filters/parameters such that when a user selects a particular store/dealership without first selecting a state, the heading only includes the store name without the Systemwide reference.

Here’s my code:

-SET &RPT_HEAD = ('Sales Year)||(' ' | &SALES_YEAR);
-SET &STATE_HEAD = IF &STATE_NAME EQ '_FOC_NULL' THEN 'Systemwide' ELSE &STATE_NAME;
-SET &STORE_HEAD = IF &STORE_NAME EQ '_FOC_NULL' THEN ' ' ELSE &STORE_NAME;

Those parameters appear later in the code like this:

SUM PCT.MV_SALES.MV_SALES.HEADCOUNT/P8.1 AS " "
BY MV_SALES.MV_SALES.SALESPERSON
WHERE MV_SALES.MV_SALES.PRODUCT_NAME NE 'Not Included';
WHERE MV_SALES.MV_SALES.SALES_YEAR EQ '&SALES_YEAR.(FIND MV_SALES.MV_SALES.SALES_YEAR IN MV_SALES).Year:.';
WHERE MV_SALES.MV_SALES.STORE_NAME EQ '&STORE_NAME.(FIND MV_SALES.MV_SALES.STORE_NAME IN MV_SALES).Store:.';
WHERE (MV_SALES.MV_SALES.PRODUCT_NAME NE 'Not Included' ) AND MV_SALES.MV_SALES.STATE_NAME EQ '&STATE_NAME.(,,,).State:.';
HEADING
"Acme Product Company"
"Number of Sales Transactions by Salesperson"
"&RPT_HEAD"
"&STATE_HEAD"
"&STORE_HEAD"

In my HTML page, the STATE_NAME parameter is a static parameter with an ignore value of “Statewide.”

The STORE_NAME parameter is a dynamic parameter and is chained to the STATE_NAME parameter. An ALL option in the STORE_NAME parameter allows users to select a particular state and run the report for all of the stores in that state.

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


WebFocus 8.2.04
WebFocus 8.2.04

April 18, 2016, 10:33 AM
BabakNYC
One of the most effective debuging techniques with variables is to use
-SET &ECHO=ALL; 

at the very top of the .fex so when you look at the page source, you'll see what values are being substituted. You might be looking for _FOC_NULL but maybe your HTML is sending FOC_NONE. Take a look at the substitutions in the echo so you can figure out how to deal with the IF THEN ELSE.


WebFOCUS 8206, Unix, Windows
April 18, 2016, 10:34 AM
Dave
This will do the trick, if I understand your question correctly.



instead of
CODE]
-SET &STATE_HEAD = IF &STATE_NAME EQ '_FOC_NULL' THEN 'Systemwide' ELSE &STATE_NAME;
[/CODE]

do
-SET &STATE_HEAD = IF &STATE_NAME EQ '_FOC_NULL' AND &STORE_NAME EQ '_FOC_NULL' THEN 'Systemwide' ELSE
-                  IF &STATE_NAME EQ '_FOC_NULL' THEN '' ELSE &STATE_NAME ;


So,
State_head will only be 'Systemwide' if both State and Store are _FOC_NULL.
If State is _FOC_NULL but STORE isn't it's ''
and is State isn't _FOC_NULL then be whatever the selection was.

Good luck !


_____________________
WF: 8.0.0.9 > going 8.2.0.5
April 18, 2016, 12:40 PM
JulieA
Dave:

You understood my question correctly, and I think I finally have set it properly at the fex and the html levels. Thank you.

I now need to eliminate the blank line between the sales year and the store name whenever the state is left blank.

I suspect it has to do with DRPBLNKLINE, but so far, I've not been successful. I'm going to keep researching that piece.

Thanks again.


WebFocus 8.2.04
WebFocus 8.2.04

April 18, 2016, 04:01 PM
susannah
don't know what DRPBLANKLINE is , but I do this sort of thing the easy way.
I create a comment field based upon the value in &STATE_HEAD.
eg:
-SET &cmt_statehead= IF &STATE_HEAD.QUOTEDSTRING IS &STATE_NAME.QUOTEDSTRING THEN ' ' ELSE '-*';
.... then

HEADING
"Acme Product Company"
"Number of Sales Transactions by Salesperson"
"&RPT_HEAD"
&cmt_statehead.EVAL "&STATE_HEAD"
"&STORE_HEAD"




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
April 18, 2016, 04:41 PM
JulieA
Thank you Susannah! That helped me some as well. Between you and Dave, I'm almost done solving my challenge in setting my headings correctly. I'll tinker with the code you sent just a bit more. I think I know what to do now. Either way, I'll post an update soon. Thanks again.


WebFocus 8.2.04
WebFocus 8.2.04

April 19, 2016, 04:45 AM
Dave
DROPBLNKLINE is used for something else.

Problem is that we create a blank line.
Susannah tries to elimitate it by adding a comment line.

There are other solutions ( there-are-always-multiple-solutions™ )

Use IFs:
HEADING
"Acme Product Company"
"Number of Sales Transaction by Wile E. Coyote"

-IF &RPT_HEAD NE '' THEN CONTINUE ELSE GOTO SKIP_RPT_HEAD;
"&RPT_HEAD"
-SKIP_RPT_HEAD

-IF &STATE_HEAD NE '' THEN CONTINUE ELSE GOTO SKIP_STATE_HEAD;
"&STATE_HEAD"
-SKIP_STATE_HEAD

-IF &STORE_HEAD NE '' THEN CONTINUE ELSE GOTO SKIP_STORE_HEAD;
"&STORE_HEAD"
-SKIP_STATE_HEAD



Add the quotes to the parameter:
-SET &STATE_HEAD = IF &STATE_NAME EQ '_FOC_NULL' AND &STORE_NAME EQ '_FOC_NULL' THEN '"Systemwide"' ELSE
- IF &STATE_NAME EQ '_FOC_NULL' THEN '' ELSE '"' | &STATE_NAME | '"' ;
HEADING
&STATE_HEAD



Good luck


_____________________
WF: 8.0.0.9 > going 8.2.0.5
April 19, 2016, 10:50 AM
JulieA
Thank you, Dave.

As it turns out, the first post you provided helped me the most as we've decided to alter our headings somewhat . However, I want to thank you and Susannah for all of the assistance you have provided me. I'm going to save a link to these posts because I know I'll need something similar in the future.


WebFocus 8.2.04
WebFocus 8.2.04