Html Table

Topics: Developer Forum
May 30, 2009 at 10:59 PM

Hello All

My Html Table works except that it only displays 1 record. the select statement is set to select all records.

any pointers

here's the code

CASE oProp.Action=='bpta_list'
*!*  IF .NOT. USED('dataform')
*!*   USE ('dataform') IN 0 SHARED
*!*  ENDIF

*!*  SELECT dataform 
*!*  SET FILTER TO

 SELE * FROM dataform order by lname INTO CURSOR csrDform
 *GO top
  
 *lcHTMLfile = 'bp_membList.htm'  && html template
 lcHTMLfile = 'bp_DataList.html'  && html template
 lcHTMLout= FILETOSTR(oProp.HtmlPath+lcHTMLfile)
 lcHTMLout= oHTML.htmlTable('dataform',lcHTMLout,10,10,'#E5E5E5',.F.;
  ,VAL(oRequest.querystring("page")),oRequest.querystring("nav"))
 lcHTMLout= oHTML.mergetext(lcHTMLout)

Coordinator
May 31, 2009 at 2:20 AM

So your html looks something like this?:

<dataform>

Company

Contact

Title

<%=csrDform.company%> <%=csrDform.Contact%> <%= csrDform.Title %>

</dataform>

Jun 4, 2009 at 8:11 PM

The culprit was the html tags for the table. it's working now

Aug 26, 2009 at 10:00 AM
Edited Aug 26, 2009 at 10:07 AM
larryj wrote:

The culprit was the html tags for the table. it's working now

what do you do to make this work....wich html tags you remove or edit to make it work.   help me please i have the same problem...sorry for my english.

this is my code:

SELECT Encmerc
    oSession.VALUE("xxxx1",encmerc.xxx1)
    oSession.VALUE("xxxx2",encmerc.xxx2)
    oSession.VALUE("xxxx3",encmerc.xxx3)
    oSession.VALUE("xxxx4",encmerc.xxx4)
    oSession.VALUE("xxxx5",encmerc.xxx5)
    oSession.VALUE("xxxx6",encmerc.xxx5)

      SET ENGINEBEHAVIOR 70
      SELECT * ;
        FROM datadbc!linmerc ;
       where linmerc.xxxx1 = lcCustID;
 INTO CURSOR x2
 SELECT x2

    lcHTMLfile = 'sesioncliente.htm'
    lcHTMLout=FILETOSTR(oProp.HtmlPath+lcHTMLfile)
    lcHTMLout= oHTML.htmlTable('formulario',lcHTMLout,10,10,'#E5E5E5',.F.;
        ,VAL(oRequest.querystring("page")),oRequest.querystring("nav"))
    lcHTMLout= oHTML.mergetext(lcHTMLout)
ELSE
    lcHTMLout= 'Not Found!'
ENDIF

**************** HTML******

include the sesion values in top

after this

<formulario>

         <%=x2.campo1%>                 <%=x2.campo3%> .....etc...

</formulario>

Aug 26, 2009 at 11:41 AM

I think where you have the "formulario" tags in the html page these should be replaced with "<linmerc> </linmerc> which is the name of the data table.

let me know if that works

Aug 28, 2009 at 4:41 AM

sorry, no work i change formulario by linmerc and nothing same thing..

Sep 9, 2009 at 9:13 AM

somebody can help me please i cant solve this issue

Coordinator
Sep 9, 2009 at 6:07 PM
Edited Sep 9, 2009 at 6:08 PM

It's whatever you name it in your HTMLtable method (1st param) as in the demo and will use whatever table or cursor is open:

lcHTMLout= oHTML.htmlTable('customers',lcHTMLout,10,5,'#E5E5E5',.F.;
        ,VAL(oRequest.querystring("page")),oRequest.querystring("nav"),[&fi=fo&fo=fi])

<customers>

Company

Contact

Title

<%=tCursor.company%> <%=tCursor.Contact%> <%= tCursor.Title %>

</customers>

 

Does the demo work?  If so, try changing the name in the html demo to match what's in your htmlTable method call.  What you've got seems like it should work (formulario) but there must be something happening that I can't see.  All spelling is correct??  Is it really calling your section of code?  SQL correct?

Sep 9, 2009 at 6:35 PM

OK. THIS IS MY CODE. activevfp 4.1

   SELECT linmerc.bultos, linmerc.referencia,linmerc.descripcion,linmerc.ancho,;
             linmerc.largo,linmerc.altura, linmerc.volumen ;
        FROM datadbc!linmerc ;
       where linmerc.orden = 12345;
 INTO CURSOR tcursor

    lcHTMLfile = 'sesioncliente.htm'
    lcHTMLout=FILETOSTR(oProp.HtmlPath+lcHTMLfile)
    lcHTMLout= oHTML.htmlTable('linmerc',lcHTMLout,10,5,'#E5E5E5',.F.;
        ,VAL(oRequest.querystring("page")),oRequest.querystring("nav"))
    lcHTMLout= oHTML.mergetext(lcHTMLout)

 

HTML.

<linmerc>

Bultos Referencia Descripcion Ancho Largo Altura Volumen
<%=tcursor.bultos%>; <%=tcursor.referencia%> <%=tcursor.descripcion%> <%= tcursor.ancho%> <%= tcursor.largo%> <%= tcursor.altura%> <%= tcursor.Volumen%>

</linmerc>

 

if you want i send a Message to you email with the demo page.

 

Coordinator
Sep 9, 2009 at 8:29 PM

First of all, what are you getting for output?  Just one record or an error message??

 

Sep 9, 2009 at 8:39 PM

only one record of 3 records...

first off all...i use :

1. login page

2. the next page show 2 items and links in the frist field  to acces to the next page that show the records that have this item

3. the page only show 1 record of 3 records that have the link in the second page.

Sep 9, 2009 at 8:44 PM

this is the code of the process after i click in item of second page:

<%=oProp.ScriptPath +[?action=detail&orden=]+allTRIM(str(orden))%>

 

FUNCTION RecordDetail
LOCAL lcHTMLfile,lcHTMLout,lcCustID
lcCustID=VAL(oRequest.querystring("orden"))
IF .NOT. USED('\yumo\datos\encmerc')
    USE ('\yumo\datos\encmerc') IN 0 SHARED
ENDIF
SELECT encmerc
SET ORDER TO orden
SEEK lccustid
IF .NOT. EOF()
* Session values will populate HTML template
    oSession.VALUE("orden",encmerc.orden)
    oSession.VALUE("fecha",DTOC(encmerc.fecha))
    IF .not. USED('\yumo\datos\clientes')
       USE ('\yumo\datos\clientes') IN 0 SHARED
    ENDIF
       SELECT clientes
       SET ORDER TO codigo
       SEEK encmerc.cliente
       
    oSession.VALUE("cliente",ALLTRIM(Clientes.nombre)+' '+alltrim(clientes.apellido))

    IF .not. USED('\yumo\datos\empresas')
       USE ('\yumo\datos\empresas') IN 0 SHARED
    ENDIF
       SELECT empresas
       SET ORDER TO codigo
       SEEK encmerc.empresa
    
    oSession.VALUE("empresa",ALLTRIM(Empresas.nombre))

    SELECT Encmerc
    oSession.VALUE("bultosrec",encmerc.bultosrec)
    oSession.VALUE("pesobruto",encmerc.pesobruto)
    oSession.VALUE("pesoneto",encmerc.pesoneto)
    oSession.VALUE("cubicajecbf",encmerc.cubicajecbf)
    oSession.VALUE("cubicajecbm",encmerc.cubicajecbm)
    oSession.VALUE("marca",encmerc.marca)

    SELECT clientes
    USE

    SELECT empresas
    USE
    
    SELECT encmerc
    use

      SET ENGINEBEHAVIOR 70
SELECT linmerc.bultos, linmerc.referencia,linmerc.descripcion,linmerc.ancho,;
             linmerc.largo,linmerc.altura, linmerc.volumen ;
        FROM datadbc!linmerc ;
       where linmerc.orden = lcCustID;
 INTO CURSOR tcursor

    lcHTMLfile = 'sesioncliente.htm'
    lcHTMLout=FILETOSTR(oProp.HtmlPath+lcHTMLfile)
    lcHTMLout= oHTML.htmlTable('linmerc',lcHTMLout,50,5,'#E5E5E5',.F.;
        ,VAL(oRequest.querystring("page")),oRequest.querystring("nav"))
    lcHTMLout= oHTML.mergetext(lcHTMLout)

ELSE
    lcHTMLout= 'Not Found!'
ENDIF
RETURN lcHTMLout
ENDFUNC

 

Coordinator
Sep 9, 2009 at 10:43 PM
Edited Sep 11, 2009 at 2:26 PM

So sesioncliente.htm contains:

<formulario>

         <%=tcursor.campo1%>                 <%=tcursor.campo3%> .....etc...

</formulario>

** Make sure <formulario> and </formulario> in the HTML don't have any spaces or weird characters.  It would evaluate to the first record only if the HTMLtable method is NOT finding the <formulario></formulario> tags.  Otherwise it will write a an html record for each record in the open table or cursor (which should be tcursor in your case).

If the HTML is definitely correct, simplify or re-check your sql.  Are you sure it's really selecting 3 records in your code??

 

 

 

Oct 7, 2009 at 8:22 AM

thanks for all. i solve the issue. for all people in this forum...

take care with the codes in html file. sorry for my english.

in the table that contain the fields with <%=field%> check if yoru code is like this: BOLD

                             </tr>
                                    <td width="127">
                                    <p align="center">&lt;%=filed%&gt;</td>
                             </tr>

all columns configure like this..only that codes in this section. for work fine. if you have five columns look:

                             </tr>
                                    <td width="127">
                                   
<p align="center">&lt;%=filed1%&gt;</td>
                                   
<td width="127">
                                    <p align="center">
&lt;%=filed2%&gt;</td>
                                   
<td width="127">
                                    <p align="center">&lt;%=filed3%&gt;</td>
 
                                  <td width="127">
                                    <p align="center">&lt;%=filed4%&gt;</td>
  
                                 <td width="127">
                                    <p align="center">&lt;%=filed5%&gt;</td>
                             </tr>

thanks for all.