Focal Point
How to remove ALL option when there's only 1 item in dropdown?

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

March 13, 2012, 05:51 AM
Wep5622
How to remove ALL option when there's only 1 item in dropdown?
We have a launch page that contains a dynamic dropdown with options based on who logged in. For some people this dropdown only contains 1 dynamically generated option, but also the static 'ALL' option.

It doesn't make sense to have 'ALL' when you only have 1 choice. Is there some setting somewhere that removes 'ALL' when there are ≤ 1 options available?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
March 15, 2012, 03:12 PM
DavSmith
Hi WEP,

I've run into this on occasion and am not aware of a switch to toggle it. So, I've had to handle it manually by adding a text value called ALL to the HOLD file and appending the actual values to this HOLD file so that the control drop-down displays the values with ALL appearing at the top. This may or may not work for you probably based on the number of records in the tables used to populate the controls.

This uses the CAR file and has 3 drop-downs for Country, Car, and Model. The report displays these 3 fields plus Bodytype. ALL will only display in the Car/Model controls if there is more than one which is based on the Country and then Car values selected.

I'm only providing the controls and report embedded code because of possible HTML Composer version incompatibility. For testing, you should be able to drop these code examples into your own HTML Composer session, but if you would like the full HTML Composer code which includes the HTML and JavaScript, let me know.

The following embedded code is behind 3 chained controls Country, Car, and Model and then finally the report code.

COUNTRY control
Datatype=DYNAMIC, Embedded
Value=COUNTRY
Display=COUNTRY
All=ON
Cache=ON
TABLE FILE car
SUM FST.CAR.ORIGIN.COUNTRY
 BY CAR.ORIGIN.COUNTRY
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END


CAR control
Datatype=DYNAMIC, Embedded
Value=CAR
Display=CAR
All=OFF
Cache=ON
SET HOLDLIST=PRINTONLY
TABLE FILE CAR
SUM CAR NOPRINT 
BY CAR
ON TABLE HOLD
WHERE COUNTRY EQ '&COUNTRY'
END
-RUN
-IF &LINES EQ 1 GOTO SKIPALL;
FILEDEF HOLD DISK HOLD.FTM
-RUN
-WRITE HOLD ALL
FILEDEF HOLD DISK HOLD.FTM (APPEND
TABLE FILE CAR
SUM CAR NOPRINT 
BY CAR
WHERE COUNTRY EQ '&COUNTRY'
ON TABLE HOLD FORMAT ALPHA
END
-SKIPALL
TABLEF FILE HOLD
LIST CAR
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END


MODEL control
Datatype=DYNAMIC, Embedded
Value=MODEL
Display=MODEL
All=OFF
Cache=ON
-SET &CAR=IF &CAR EQ 'ALL' THEN 'FOC_NONE' ELSE '&CAR.EVAL'; 
SET HOLDLIST=PRINTONLY
TABLE FILE CAR
SUM MODEL NOPRINT 
BY MODEL
WHERE COUNTRY EQ '&COUNTRY'
WHERE CAR EQ '&CAR'
ON TABLE HOLD
END
-RUN
-IF &LINES LE 1 GOTO SKIPALL;
FILEDEF HOLD DISK HOLD.FTM
-RUN
-WRITE HOLD ALL
FILEDEF HOLD DISK HOLD.FTM (APPEND
TABLE FILE CAR
SUM MODEL NOPRINT 
BY MODEL
WHERE COUNTRY EQ '&COUNTRY'
WHERE CAR EQ '&CAR'
ON TABLE HOLD FORMAT ALPHA
END
-SKIPALL
TABLEF FILE HOLD
LIST MODEL
-*insert_filters_here
ON TABLE PCHOLD FORMAT XML
END


REPORT code
-SET &CAR=IF '&CAR.EVAL' EQ 'ALL' THEN 'FOC_NONE' ELSE '&CAR.EVAL';
-SET &MODEL=IF '&MODEL.EVAL' EQ 'ALL' THEN 'FOC_NONE' ELSE '&MODEL.EVAL';
TABLE FILE CAR
PRINT 
     BODYTYPE
BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY EQ '&COUNTRY' 
WHERE CAR EQ '&CAR'
WHERE MODEL EQ '&MODEL'
ON TABLE SET PAGE-NUM OFF 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=9,
$
TYPE=TITLE,
     STYLE=BOLD,
$
ENDSTYLE
END

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



In FOCUS since 1985 - WF 8.009/8.104 Win 8 Outputs: ALL of 'em! Adapters: Sql Server Teradata Oracle
March 16, 2012, 09:16 AM
MAdams1
I'm no Guru, but I had this happen once and I just changed the drop down to multi-select and unchecked the 'ALL' option. That way the user could pick one or two or all or however many selections their little hearts desired.

Smiler


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML