Focal Point
[SOLVED] Multiple Default Values

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

March 01, 2016, 02:49 PM
rogerwilkouk
[SOLVED] Multiple Default Values
99% of the time I get tremendous results just searching this forum band finding what I need to point me in the right direction (Thank you to everyone who participates) but this one seems to have stumped me.
I know by it's very nature, a default value is just that, the default, however I am trying to find a way to supply multiple default values.
An example is the CAR fex below.

 
TABLE FILE CAR
PRINT 
     CAR.COMP.CAR
     CAR.CARREC.MODEL
BY  LOWEST CAR.ORIGIN.COUNTRY
WHERE COUNTRY EQ &COUNTRY;
ON TABLE SET PAGE-NUM NOLEAD 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT XLSX
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END
 

At the Prompt, if you type in 'ENGLAND' OR 'FRANCE' (as the full string) then you just get England and France.

We'd like the 'ENGLAND' OR 'FRANCE' to be the default value in the prompt field but when I type that as -DEFAULT &COUNTRY = 'ENGLAND' OR 'FRANCE', it doesn't like it and just has ENGLAND. I've tried what seems to all sorts of combinations of quotes, single quotes and double quotes but can't seem to get it.

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


WF 81.5, Windows7
AS/400 Database.
All Outputs

March 01, 2016, 02:57 PM
BabakNYC
Autoprompt allows you to pick one default which is usually the first value on the list. You can let them multiselect by using this code:

WHERE CAR.ORIGIN.COUNTRY EQ &COUNTRY.(OR(<ENGLAND>,<FRANCE>,<ITALY>,<JAPAN>,<W GERMANY>)).COUNTRY:.;




WebFOCUS 8206, Unix, Windows
March 01, 2016, 03:11 PM
Tom Flynn
Don't hard-code, get your values from a table/DB:

WHERE CAR.ORIGIN.COUNTRY EQ &COUNTRY.(OR(FIND COUNTRY IN CAR)).Select Country.;


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
March 01, 2016, 03:32 PM
rogerwilkouk
Had a feeling that we could only select a single default value.
We were trying to get away from the drop down option due to the fact that they select the same 5 options 95% of the time and only very occasionally have to change the selection. Plus the users like the report pretty much done for them so they just click submit.

I figured I'd add an option to the report where they can run it either using the pre-defined selection or with the dropdown selection.

 
-SET &SELECTION = &SELECTION.(<Pre Defined Parameters,PRE>,<Select From List Below,SEL>).;
- IF &SELECTION = 'PRE' THEN GOTO PRE
- ELSE IF &SELECTION = 'SEL' THEN GOTO SEL
- ELSE GOTO Label1;

-Label1 TYPE 'Select Report Run Option'
-EXIT

-PRE
TABLE FILE CAR
PRINT 
     CAR.COMP.CAR
     CAR.CARREC.MODEL
BY  LOWEST CAR.ORIGIN.COUNTRY
WHERE COUNTRY EQ 'ENGLAND' OR 'FRANCE';
ON TABLE SET PAGE-NUM NOLEAD 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT XLSX
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END
-EXIT

-SEL
TABLE FILE CAR
PRINT 
     CAR.COMP.CAR
     CAR.CARREC.MODEL
BY  LOWEST CAR.ORIGIN.COUNTRY
WHERE CAR.ORIGIN.COUNTRY EQ &COUNTRY.(OR(FIND COUNTRY IN CAR)).Select Country.;
ON TABLE SET PAGE-NUM NOLEAD 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT XLSX
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END
-EXIT

 



WF 81.5, Windows7
AS/400 Database.
All Outputs

March 01, 2016, 03:33 PM
jfr99
What about this ...

-*
-DEFAULT &COUNTRY = '.'
-*
-SET &COUNTRY = IF &COUNTRY EQ '.' THEN '''ENGLAND'' OR ''FRANCE''' ELSE '''&COUNTRY.EVAL''';
-*
-TYPE COUNTRY ----- &COUNTRY
-*-EXIT
-*
TABLE FILE CAR
PRINT
CAR.COMP.CAR
CAR.CARREC.MODEL
BY LOWEST CAR.ORIGIN.COUNTRY
WHERE COUNTRY EQ &COUNTRY;
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
END


WebFocus 8.201M, Windows, App Studio
March 01, 2016, 03:35 PM
Squatch
This code doesn't give you an auto prompt, but it shows how you can default to more than one option:

-DEFAULT &COUNTRY='''ENGLAND'' OR ''FRANCE''';

TABLE FILE IBISAMP/CAR
PRINT 
     CAR.COMP.CAR
     CAR.CARREC.MODEL
BY  LOWEST CAR.ORIGIN.COUNTRY
WHERE CAR.ORIGIN.COUNTRY EQ &COUNTRY.(OR(FIND COUNTRY IN CAR)).Select Country.;
ON TABLE SET PAGE-NUM NOLEAD 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END



App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
March 01, 2016, 03:45 PM
rogerwilkouk
Thanks jfr99, that works exactly like we want/need it to.


WF 81.5, Windows7
AS/400 Database.
All Outputs