htmlTable issue

Coordinator
Sep 25, 2013 at 8:46 PM
Edited Sep 25, 2013 at 8:47 PM
I been playing with version 6.03 and I notice something that I can't seems to figure out. What's happening is the page is being displayed but values seems to be displaying on the last record:
3
3
3

instead of
1
2
3

Version 5.53 display the the page fine but I have to remove the MergeScript line.

The code on the main.prg
CASE oProp.Action=='testhtmltable'
CREATE CURSOR tcursor (cid C(10), military I)
INSERT INTO tcursor (cid, military) VALUES (SYS(2015), 1)
INSERT INTO tcursor (cid, military) VALUES (SYS(2015), 2)
INSERT INTO tcursor (cid, military) VALUES (SYS(2015), 3)

lcHTMLfile = 'tabletest'+oProp.Ext
lcHTMLout= FILETOSTR(oProp.HtmlPath+lcHTMLfile) 
lcHTMLout= oHTML.mergescript(lcHTMLout)
lcHTMLout= oHTML.htmlTable('apptment',lcHTMLout,50,0,'#E5E5E5',.F.,5,'')
lcHTMLout= oHTML.mergetext(lcHTMLout)       
*-- the HTML CODE ( tabletest.avfp)
<div class="block"> <apptment> <table border="0" class="time_data"> <tr> <td width="70"><%=tCursor.cid%></td> <td width="70"><%=tCursor.military%></td> </tr> </table> </apptment> </div>
Coordinator
Sep 25, 2013 at 10:08 PM
Can you remove the MergeScript line from 6.03 too like you did for 5.53?

Honestly, I haven't been using HTMLtable as much in the latest versions.
Coordinator
Sep 25, 2013 at 10:11 PM
Edited Sep 25, 2013 at 10:15 PM
Removing the MergeScript in 6.03 will give you runtime error:

Caught .NET exception, source: MAIN.PRG mergetext err#= 1734 line= 326 Property CEVAL is not found.1734 Property CEVAL is not found. CEVAL .NULL. .NULL. .NULL. .NULL. c:\inetpub\wwwroot\myapp\activevfp.dll message: c:\inetpub\wwwroot\myapp\activevfp.dll

By the way the CID column is displaying the same thing as well, instead of unique values.
Developer
Oct 2, 2013 at 8:54 PM
Edited Oct 2, 2013 at 9:24 PM
I noticed this too, when I was new to AVFP.

1) I think you may find the problem in htmltable() function itself. I see a lot of string comparisons of 'less than' and 'greater than' ( i.e. < and > ) using their HTML escape character equivalents.

E.g.lnAtPos1 = ATC('& lt;'+ALLTRIM(lcTableTag)+'& gt;', lcHTMLstr)


However, I did not find any of these characters in the table template html file under processing.

Therefore, the above line, I guess should have been

lnAtPos1 = ATC('<'+ALLTRIM(lcTableTag)+'>', lcHTMLstr)

I find number of such commands in htmlTable() function. All these may need to be fixed.

2) Once these are fixed, we can call the table template defined in tabletest.avfp into the testhtmltable.avfp as follows

CREATE CURSOR tcursor (cid C(10), military I)
INSERT INTO tcursor (cid, military) VALUES (SYS(2015), 1)
INSERT INTO tcursor (cid, military) VALUES (SYS(2015), 2)
INSERT INTO tcursor (cid, military) VALUES (SYS(2015), 3)

lcHTMLfile = 'tabletest'+oProp.Ext
lcHTMLout= FILETOSTR(oProp.HtmlPath+lcHTMLfile)
*--lcHTMLout= oHTML.mergescript(lcHTMLout)
*--lcHTMLout= oHTML.htmlTable('apptment',lcHTMLout,50,0,'#E5E5E5',.F.,5,'')
lcHTMLout= oHTML.htmlTable('apptment',lcHTMLout,50,0,'#E5E5E5',.F.,1,'') && note 5 is switched to 1.
--*lcHTMLout= oHTML.mergetext(lcHTMLout)

The lcHTMLout can then be embedded in the <Body> section to display the table without the table header
 <%=lcHTMLout%>
3) I still see some problems. I see three extra characters in the lcHTMLout string ( these are at the end of the string). but the table does show properly.
I don't have time for a more detailed analysis of the trace but I hope this can give a good starting point, if you plan on fixing it in future.


One more point.
After lcHTMLout= FILETOSTR(oProp.HtmlPath+lcHTMLfile) the value of lcHTMLout is shown as follows:

<div class="block"> <apptment> <table border="0" class="time_data"> <tr> <td width="70"><%=tCursor.cid%></td> <td width="70"><%=tCursor.military%></td> </tr> </table> </apptment> </div>

Notice the three characters at the start of this string?. Could be the reason for the above problem.
Coordinator
Oct 3, 2013 at 12:09 AM
Thanks a lot for looking at this one Titu1. I resorted on using the alternative way which is basically adding the code in the HTML and using FOR/ENDFOR, almost similar to the customer employee listing. I'm using the include function and created a new page/file to get my result set, this way my display page is not convoluted.

»¿ ==> I've seen this before but I can't remember how I end up fixing it. If I can recall it correctly, it has something to do with the header set UTF8 etc.
Coordinator
Oct 7, 2013 at 6:11 PM
Found it for the extra characters issue.
https://activevfp.codeplex.com/discussions/248542