Focal Point
Dynamic HTML reports and stuffis

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

July 03, 2006, 03:59 PM
Wayne Atchley
Dynamic HTML reports and stuffis
I am trying to use WebFocus to generate HTML for our new system's gui, however, I am having some difficulties. I was wondering if you could help.

To begin with, here is a brief sample of my code (inserted some spaces to show tags...):

DEFINE FILE TABLEA
DATAROW1/A50 = '< TD >' | DBCOLUMN1 '< /TD >';
DATAROW2/A50 = '< TD >' | DBCOLUMN2 '< /TD >';
END

TABLE FILE TABLEA
DATAROW1
DATAROW2
ON TABLE HOLD AS REPORT FORMAT ALPHA
END

-HTMLFORM BEGIN
< HTML >
< HEAD >
< /HEAD >
< BODY >
!IBI.FIL.REPORT;
< /TABLE >
< /BODY >
< /HEAD >
-HTMLFORM END

The problem occurs with the HTML that is given as output. Because the format is ALPHA, the HTML code that is produced has a ton of trailing spaces throughout (obviously, the concatenation of '< TD >', DBCOLUMN1, and '< /TD >' isn't 50 characters). Even though Internet Explorer only recognizes one of the spaces, it still causes problems with our resulting functionality. I have to use Javascript to constantly trim values, either upon load or when they click on a desired column. This really isn't good architecture at all. The data should be preformatted in the HTML.

I have used the HTML and HTMTABLE outputs (granted, I had to change the define file's functionality to make it work properly), however, those aren't sufficient (maybe there are some options that need to be set, however, I do not know of any). The HTML format produces a complete HTML document, which isn't what I want. The HTMTABLE option produces a table, which is what I want in the end, however, there isn't a good way of updating the tds (columns) and adding functionality. However, the one positive side is that the values are trimmed correctly.

I originally combined all of the tds into one big temporary field. In other words, my define file and table file definition looked like this:

DEFINE FILE TABLEA
DATAROW/A4096 = '< TD >' | DBCOLUMN1 '< /TD >' | '< TD >' | DBCOLUMN2 '< /TD >';
END

TABLE FILE TABLEA
DATAROW
ON TABLE HOLD AS REPORT FORMAT ALPHA
END

There didn't seem to be a problem until we realized that with the number of columns (sometimes 30+) and functionality (onclick, onmouseover, onmouseout, and more) that we wanted to add, 4096 (4K) characters was not near enough. We would run out of room and WebFocus would throw errors.

With all of this being said, I have two questions for you. 1) Is there any way to overcome the 4096 character limit (which is just too small for HTML creation) in a temporary (define/compute) field? 2) Is there any way to remove the trailing spaces and print the result using the !IBI.FIL.REPORT methodology?

Thanks for the help...

Wayne
July 03, 2006, 04:43 PM
Mikel
Wayne:

2) To remove trailing spaces, try using strong concatenation (|| operator suppresses trailing spaces vs | weak concatenation that preserves trailing spaces)

Example 2:

DEFINE FILE CAR
  TR1/A5 = '<tr>' ;
  TR2/A5 = '</tr>' ;
  DATAFIELD1/A50 = '<td>' || COUNTRY || '</td>';
  DATAFIELD2/A50 = '<td>' || CAR || '</td>';
  DATAROW/A110 = TR1 || DATAFIELD1 || DATAFIELD2 || TR2 ;
END

TABLE FILE CAR
  PRINT
    DATAROW
  ON TABLE HOLD AS REPORT FORMAT ALPHA
END

-HTMLFORM BEGIN
<html>
  <head>
  </head>
  <body>
    <table>
      !IBI.FIL.REPORT;
    </table>
  </body>
</html>
-HTMLFORM END


1) And to avoid certains problems with large line lengths, consider change ALPHA to WP FORMAT combined with OVER phrase in order to generate more but shorter lines...

Example 1:

DEFINE FILE CAR
  TR1/A5 = '<tr>' ;
  TR2/A5 = '</tr>' ;
  DATAFIELD1/A50 = '<td>' || COUNTRY || '</td>';
  DATAFIELD2/A50 = '<td>' || CAR || '</td>';
  DATAROW/A110 = TR1 || DATAFIELD1 || DATAFIELD2 || TR2 ;
END

TABLE FILE CAR
  PRINT
    TR1        AS '' OVER
    DATAFIELD1 AS '' OVER
    DATAFIELD2 AS '' OVER
    TR2        AS ''
  ON TABLE SET PAGE NOLEAD
  ON TABLE HOLD AS REPORT FORMAT WP
END

-HTMLFORM BEGIN
<html>
  <head>
  </head>
  <body>
    <table>
      !IBI.FIL.REPORT;
    </table>
  </body>
</html>
-HTMLFORM END

Hope this helps.
Regards,
Mikel


WebFOCUS 8.1.05, 8.2.01
July 04, 2006, 03:03 AM
<JG>
Wayne strong concatenation will not remove trailing spaces from the row
it will move them all to the end of the row.

The easiest option is to output as format TAB

Providing you only print a single field this will generate a variable length file
instead of a fixed length as with format ALPHA and because its only got one field
it will not insert a TAB.


 

DEFINE FILE CAR
DATAROW/A100 = '<TR><TD>' || COUNTRY || '</TD>' || '<TD>' || CAR || '</TD></TR>';
END

TABLE FILE CAR
PRINT DATAROW
ON TABLE HOLD AS REPORT FORMAT TAB
END

-HTMLFORM BEGIN
<html>
  <head>
  </head>
  <body>
    <table>
      !IBI.FIL.REPORT;
    </table>
  </body>
</html>
-HTMLFORM END


July 05, 2006, 09:43 AM
dazed
Ok, the TAB file and single field idea makes sense, however, it seems as though there could be a problem with the single field reaching more than 4k in length. Is there any way of getting around this?


WebFocus 7.6 client: WinXP server: Windows 2003 Server Edition
July 13, 2006, 11:10 AM
Wayne Atchley
Thanks JG... We are still having problems with this, but the more we understand the better.

I appreciate all the input and assistance. I thought that was a given, but apparently the bot that monitors for replies feels I need to express my gratitude in writing for everything that I ask... I don't want to get kicked off the forum, but if something works we run with it and move to the next problem... if something doesn't work, we ask questions until we either just give up and try something else, or we solve the problem...

So, Thanks for taking time to help and your idea has helped us narrow the problem. We are now stuck with some 4k limit problem... we have that submitted to NY and will hopefully find out something soon.

Wayne