Focal Point
[SOLVED] Adding actionable checkboxes to the rows of an exisiting HTML report

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

August 23, 2011, 01:04 PM
MarciaDrummond
[SOLVED] Adding actionable checkboxes to the rows of an exisiting HTML report
Here is the original sales report using the CAR database:

  
TABLE FILE CAR
PRINT
     'CAR.BODY.BODYTYPE'
BY 'CAR.ORIGIN.COUNTRY'
BY 'CAR.COMP.CAR'
BY 'CAR.CARREC.MODEL'
HEADING
"Current Cars Available for Sale"
" "
FOOTING
"As of <+0>&DATEtrMDYY <+0> "
ON TABLE SET PAGE-NUM OFF
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=10,
$
TYPE=HEADING,
     SIZE=14,
     STYLE=BOLD,
$
TYPE=FOOTING,
     SIZE=12,
     STYLE=BOLD,
$
ENDSTYLE
END


The Sales and Warranty departments have had some discussions regarding potential changes to the current auto warranties being offered. They would like to keep this report 'as is' with the single addition of a checkbox in front of the front the first column (Country) and on each row. Additionally a 'Send to email' hyperlink would be added to the footing and when it is clicked, only the data on the rows where the checkbox has been selected will be emailed to the user. Each model will already be a drill-down to send the information for individual vehicles by email, but they would also like the option to send a group of rows at once.

Is this possible?

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


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports
August 23, 2011, 02:04 PM
<FreSte>
Yes, that's possible (see below) and you need also some javascript to collect all the checked lines/id's for further action
(the id in this example is now hardcoded to XXX)

-Fred-

DEFINE FILE CAR
  CB/A100 = '<input type="CHECKBOX" id="XXX" />';
END
TABLE FILE CAR
PRINT 
     'CAR.BODY.BODYTYPE'
BY CB
BY 'CAR.ORIGIN.COUNTRY'
BY 'CAR.COMP.CAR'
BY 'CAR.CARREC.MODEL'
HEADING
"Current Cars Available for Sale"
" "
FOOTING
"As of <+0>&DATEtrMDYY <+0> "
ON TABLE SET BYDISPLAY ON
ON TABLE SET PAGE-NUM OFF
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=10,
$
TYPE=HEADING,
     SIZE=14,
     STYLE=BOLD,
$
TYPE=FOOTING,
     SIZE=12,
     STYLE=BOLD,
$
ENDSTYLE
END

August 23, 2011, 02:38 PM
MarciaDrummond
Thanks, Fred!

If you have the JavaScript already, I'd appreciate it. Wink If not, I'll search it out.

This request is just one of many that I am working on and I am thankful for your response.

Marcia

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


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports
August 23, 2011, 04:04 PM
<FreSte>
Marcia,

I didn't have it already, but as the weather here in the Netherlands is terrible and there's nothing on the television so, here you go Smiler

It's just a basic example. All you need to add is the URL that will start your fex that needs
the clicked ID's and add these ID's (see var _params in javaScript)

DEFINE FILE CAR
  ID1/I5 WITH MODEL = LAST ID1 + 1;
  AID1/A5   = FPRINT(ID1, 'I5' , 'A5');
  AID2/A5   = TRIM('L', AID1, 5, ' ', 1, 'A5');
  CB/A100   = '<input type="CHECKBOX" id="' || AID2 || '" />';
END
TABLE FILE CAR
PRINT
     'CAR.BODY.BODYTYPE'
BY CB AS ''
BY 'CAR.ORIGIN.COUNTRY'
BY 'CAR.COMP.CAR'
BY 'CAR.CARREC.MODEL'
HEADING
"Current Cars Available for Sale"
" "
FOOTING
"As of <+0>&DATEtrMDYY <+0> "
ON TABLE SET BYDISPLAY ON
ON TABLE SET PAGE-NUM OFF
ON TABLE HOLD AS RPRT FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=10,
$
TYPE=HEADING,
     SIZE=14,
     STYLE=BOLD,
$
TYPE=FOOTING,
     SIZE=12,
     STYLE=BOLD,
$
ENDSTYLE
END
-RUN

-HTMLFORM BEGIN
<html>
<script>
function showCheckedItems() {
    var _allCbxs = document.getElementsByTagName("input");
    var _length  = _allCbxs.length;
    var _params  = "";

    for (var i=0; i < _length; i++) {
        if (_allCbxs[i].type == "checkbox" && _allCbxs[i].checked) {
            _params += "&" + "ID=" + _allCbxs[i].id;
        }
    }

    alert("The following IDs are checked:\n\n" + _params);
}

</script>
<body>
!IBI.FIL.RPRT;
<br>
<input type="button" value="Show checked items" onclick="showCheckedItems();">
</body>
</html>
-HTMLFORM END

This message has been edited. Last edited by: <FreSte>,
August 23, 2011, 04:10 PM
MarciaDrummond
Ahhhh!!!!! Big Grin

Fred, you are the best!

I appreciate you putting this together for me.

I will test it and let you know how it works for me - I needed this opportunity to "come up for air" from this other application that I am working on.

Cheers!!! Smiler

Marcia

P.S. Not only does is work, you have introduced me to the FPRINT function. Another one of those "secrets" that comes available in a release, but not documented until later.

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


WebFOCUS 7.73
Windows, Unix, AS/400 (iSeries)
HTML, PDF, MS Excel (including templates), HTML Active Reports