Focal Point
Retaining Checkbox Selecitons [SOLVED]

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

October 27, 2008, 05:09 PM
ChannyS
Retaining Checkbox Selecitons [SOLVED]
In the fex below, does anyone have any ideas how to maintain the checkbox selections even after the user selects on a column to resort (selecting on the column causes a self drill which means the report is run again which is why I lose the selections)

-* File SelfDrillDown.fex
-SET &ECHO=ON;

-DEFAULTS &SORTORD='FIRST';
-* Previous sort column:
-DEFAULTS &PREVSRT='FIRST';
-* The SORTCOL column is used for sorting:
-DEFAULTS &SORTCOL='COUNTRY';
-* Set up the sort order appropriately:
-SET &SORTORD= IF &PREVSRT NE &SORTCOL THEN 'LOWEST' ELSE
- IF &SORTORD EQ 'LOWEST' THEN 'HIGHEST' ELSE 'LOWEST';
-*

DEFINE FILE CAR
COUNTER/D5 WITH CAR = COUNTER + 1 ;
INFLD/A255='
 <INPUT name=WHICH_CAR value=' | CAR | 'TYPE=CHECKBOX ID=car_checkbox1_' | EDIT(COUNTER) | '>  
';
END

TABLE FILE CAR
PRINT
INFLD AS ''
CAR
COUNTRY
BY &SORTORD TOTAL &SORTCOL NOPRINT
WHERE CAR.ORIGIN.COUNTRY EQ 'ENGLAND' OR 'FRANCE'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET PAGE-NUM OFF
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=8,
COLOR='BLACK',
STYLE=NORMAL,

$

TYPE=TITLE, COLUMN=P2, FOCEXEC=test ( \
PREVSRT='&SORTCOL' \
SORTCOL='CAR' \
SORTORD='&SORTORD' \
), $


TYPE=TITLE, COLUMN=P3, FOCEXEC=test ( \
PREVSRT='&SORTCOL' \
SORTCOL='COUNTRY' \
SORTORD='&SORTORD' \
), $


TYPE=TITLE, STYLE=-UNDERLINE,$
ENDSTYLE
END

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


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
October 27, 2008, 07:06 PM
j.gross
You need to have the report ("test.fex") pass the selected values (to itself) in its drilldowns. The problem is, the number of values selected is variable, and the set of parameters it initially receives varies accordingly, so what do you pass and how do you avoid referencing non-existent parameter variables?

You could set an arbitrary limit, say n selections, provide -DEFAULT for each of the n+2 variables that might be received, and pass them all in the drilldown.

Alternatively, combine the received list of selections into a single variable (say &CAR_LIST) using some safe delimiter character, pass that one parameter in the drilldown, and reconstitute the original set of selection parameter variables (when applicable) at the top of the fex, utilizing GETTOK().

Another alternative is to use a dialog manager loop to generate the portion of the drilldown code that lists the parameter names and values. (If you have multiple drilldowns, make sure your loop labels are distinct.)

This message has been edited. Last edited by: j.gross,


- Jack Gross
WF through 8.1.05
October 27, 2008, 09:26 PM
j.gross
As it stands, your fex does not pass the selected WHICH_CAR values. That's because the FOCEXEC= type of drilldown creates a URL containing all the parameters specified in the stylesheet, so the WHICH_CAR selections can never make it aboard.

Use JAVASCRIPT= for the drilldown, imbed the report (containing the INPUT controls) within the scope of a FORM, and supply a JS function to submit the form.


- Jack Gross
WF through 8.1.05
October 28, 2008, 09:57 AM
j.gross
On closer reading ... I think I misread your intent. You want this report fex to grow into a launch page to another report (the real purpose of the check-boxes), but also to allow the user to resort this report on a user-selected column, proserving the checked/unchecked state of the boxes.

You don't need to go back to the datasource (and re-execute the fex) for that; there are javascript 'tablesort' functions available that do just that: sort the TD rows of a TABLE on one of the columns when the column header (TH) text is clicked, and reverse the sort if the same title is clicked again.

See for example, sorttable: Make all your tables sortable


- Jack Gross
WF through 8.1.05
October 28, 2008, 10:08 AM
ChannyS
Thanks this looks neat but since I am not generating the table, how will I set the class?


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
October 28, 2008, 10:57 AM
j.gross
In javascript, on load.

Or customize sorttable.js to operate on the first TABLE, regardless of class attribute.

This message has been edited. Last edited by: j.gross,


- Jack Gross
WF through 8.1.05