Hi
Is this the right way to print a generic Dataset report ? :
With Object ::oDbf
:Select()
:SaveState(.T.)
:Gotop()
End
REPORT oReport ;
TITLE ::oDbf:cName ;
FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
" "+DToC(Date())+" "+Time() ALIGN taCENTER ;
PREVIEW ;
FONT oFont1, oFont2
For nFor := 1 To Len(::oDbf:aFields)-1
With Object oCol := TRptColumn():New()
:aTitle := {{||::oDbf:aFields[nFor]:cName}}
:aData := {{||::oDbf:aFields[nFor]:Value}}
:nDataFont := 2
:oReport := oReport
End
oReport:AddColumn(oCol)
Next
RUN REPORT oReport
::oDbf:RestoreState(.T.)
It gives me an error !!
Thanks
Aguiar !!!
Attached files Error.log (1.4 KB)Â
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Report
-
- Mensajes: 115
- Registrado: Jue Jun 01, 2006 7:21 pm
- ignacio
- Site Admin
- Mensajes: 9259
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Report
Aguiar,
No, is not the right way because nFor value is always equal to
Len(::oDbfaFields) and this happens because nFor is inside a code-block, if
you change nFor, when the code-block is evaluated it will use the current
value, not the old value that it had when you create the code-block.
In order to avoid this problem you should create code-block with detached
locals. Here is a sample:
With Object oCol := TRptColumn():New()
:aTitle := GenBlockForTitle( ::oDbf, nFor )
End
FUNCTION GenBlockForTitle( oDataSet, nFor )
RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
Regards,
"Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Hi
>
> Is this the right way to print a generic Dataset report ? :
>
> With Object ::oDbf
> :Select()
> :SaveState(.T.)
> :Gotop()
> End
> REPORT oReport ;
> TITLE ::oDbf:cName ;
> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
> PREVIEW ;
> FONT oFont1, oFont2
>
> For nFor := 1 To Len(::oDbf:aFields)-1
> With Object oCol := TRptColumn():New()
> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
> :aData := {{||::oDbf:aFields[nFor]:Value}}
> :nDataFont := 2
> :oReport := oReport
> End
> oReport:AddColumn(oCol)
> Next
>
> RUN REPORT oReport
> ::oDbf:RestoreState(.T.)
>
> It gives me an error !!
> Thanks
> Aguiar !!!
>
>
No, is not the right way because nFor value is always equal to
Len(::oDbfaFields) and this happens because nFor is inside a code-block, if
you change nFor, when the code-block is evaluated it will use the current
value, not the old value that it had when you create the code-block.
In order to avoid this problem you should create code-block with detached
locals. Here is a sample:
With Object oCol := TRptColumn():New()
:aTitle := GenBlockForTitle( ::oDbf, nFor )
End
FUNCTION GenBlockForTitle( oDataSet, nFor )
RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
Regards,
"Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Hi
>
> Is this the right way to print a generic Dataset report ? :
>
> With Object ::oDbf
> :Select()
> :SaveState(.T.)
> :Gotop()
> End
> REPORT oReport ;
> TITLE ::oDbf:cName ;
> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
> PREVIEW ;
> FONT oFont1, oFont2
>
> For nFor := 1 To Len(::oDbf:aFields)-1
> With Object oCol := TRptColumn():New()
> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
> :aData := {{||::oDbf:aFields[nFor]:Value}}
> :nDataFont := 2
> :oReport := oReport
> End
> oReport:AddColumn(oCol)
> Next
>
> RUN REPORT oReport
> ::oDbf:RestoreState(.T.)
>
> It gives me an error !!
> Thanks
> Aguiar !!!
>
>
Report
Aguiar,
No, is not the right way because nFor value is always equal to
Len(::oDbfaFields) and this happens because nFor is inside a code-block, if
you change nFor, when the code-block is evaluated it will use the current
value, not the old value that it had when you create the code-block.
In order to avoid this problem you should create code-block with detached
locals. Here is a sample:
With Object oCol := TRptColumn():New()
:aTitle := GenBlockForTitle( ::oDbf, nFor )
End
FUNCTION GenBlockForTitle( oDataSet, nFor )
RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
Regards,
"Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Hi
>
> Is this the right way to print a generic Dataset report ? :
>
> With Object ::oDbf
> :Select()
> :SaveState(.T.)
> :Gotop()
> End
> REPORT oReport ;
> TITLE ::oDbf:cName ;
> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
> PREVIEW ;
> FONT oFont1, oFont2
>
> For nFor := 1 To Len(::oDbf:aFields)-1
> With Object oCol := TRptColumn():New()
> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
> :aData := {{||::oDbf:aFields[nFor]:Value}}
> :nDataFont := 2
> :oReport := oReport
> End
> oReport:AddColumn(oCol)
> Next
>
> RUN REPORT oReport
> ::oDbf:RestoreState(.T.)
>
> It gives me an error !!
> Thanks
> Aguiar !!!
>
>
No, is not the right way because nFor value is always equal to
Len(::oDbfaFields) and this happens because nFor is inside a code-block, if
you change nFor, when the code-block is evaluated it will use the current
value, not the old value that it had when you create the code-block.
In order to avoid this problem you should create code-block with detached
locals. Here is a sample:
With Object oCol := TRptColumn():New()
:aTitle := GenBlockForTitle( ::oDbf, nFor )
End
FUNCTION GenBlockForTitle( oDataSet, nFor )
RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
Regards,
"Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Hi
>
> Is this the right way to print a generic Dataset report ? :
>
> With Object ::oDbf
> :Select()
> :SaveState(.T.)
> :Gotop()
> End
> REPORT oReport ;
> TITLE ::oDbf:cName ;
> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
> PREVIEW ;
> FONT oFont1, oFont2
>
> For nFor := 1 To Len(::oDbf:aFields)-1
> With Object oCol := TRptColumn():New()
> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
> :aData := {{||::oDbf:aFields[nFor]:Value}}
> :nDataFont := 2
> :oReport := oReport
> End
> oReport:AddColumn(oCol)
> Next
>
> RUN REPORT oReport
> ::oDbf:RestoreState(.T.)
>
> It gives me an error !!
> Thanks
> Aguiar !!!
>
>
-
- Mensajes: 115
- Registrado: Jue Jun 01, 2006 7:21 pm
Report
Ignacio,
Thank you for your answer, but it still report the same error...maybe it's
another problem...Can you help ?
Thanks.
Aguiar !!!
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escreveu na mensagem
news:44ae1276$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Aguiar,
>
> No, is not the right way because nFor value is always equal to
> Len(::oDbfaFields) and this happens because nFor is inside a code-block,
> if
> you change nFor, when the code-block is evaluated it will use the current
> value, not the old value that it had when you create the code-block.
>
> In order to avoid this problem you should create code-block with detached
> locals. Here is a sample:
>
> With Object oCol := TRptColumn():New()
> :aTitle := GenBlockForTitle( ::oDbf, nFor )
> End
>
> FUNCTION GenBlockForTitle( oDataSet, nFor )
>
> RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
>
> Regards,
>
> "Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
> news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> Hi
>>
>> Is this the right way to print a generic Dataset report ? :
>>
>> With Object ::oDbf
>> :Select()
>> :SaveState(.T.)
>> :Gotop()
>> End
>> REPORT oReport ;
>> TITLE ::oDbf:cName ;
>> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
>> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
>> PREVIEW ;
>> FONT oFont1, oFont2
>>
>> For nFor := 1 To Len(::oDbf:aFields)-1
>> With Object oCol := TRptColumn():New()
>> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
>> :aData := {{||::oDbf:aFields[nFor]:Value}}
>> :nDataFont := 2
>> :oReport := oReport
>> End
>> oReport:AddColumn(oCol)
>> Next
>>
>> RUN REPORT oReport
>> ::oDbf:RestoreState(.T.)
>>
>> It gives me an error !!
>> Thanks
>> Aguiar !!!
>>
>>
>
>
>
Attached files Error.log (1.4 KB)Â
Thank you for your answer, but it still report the same error...maybe it's
another problem...Can you help ?
Thanks.
Aguiar !!!
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escreveu na mensagem
news:44ae1276$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Aguiar,
>
> No, is not the right way because nFor value is always equal to
> Len(::oDbfaFields) and this happens because nFor is inside a code-block,
> if
> you change nFor, when the code-block is evaluated it will use the current
> value, not the old value that it had when you create the code-block.
>
> In order to avoid this problem you should create code-block with detached
> locals. Here is a sample:
>
> With Object oCol := TRptColumn():New()
> :aTitle := GenBlockForTitle( ::oDbf, nFor )
> End
>
> FUNCTION GenBlockForTitle( oDataSet, nFor )
>
> RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
>
> Regards,
>
> "Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
> news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> Hi
>>
>> Is this the right way to print a generic Dataset report ? :
>>
>> With Object ::oDbf
>> :Select()
>> :SaveState(.T.)
>> :Gotop()
>> End
>> REPORT oReport ;
>> TITLE ::oDbf:cName ;
>> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
>> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
>> PREVIEW ;
>> FONT oFont1, oFont2
>>
>> For nFor := 1 To Len(::oDbf:aFields)-1
>> With Object oCol := TRptColumn():New()
>> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
>> :aData := {{||::oDbf:aFields[nFor]:Value}}
>> :nDataFont := 2
>> :oReport := oReport
>> End
>> oReport:AddColumn(oCol)
>> Next
>>
>> RUN REPORT oReport
>> ::oDbf:RestoreState(.T.)
>>
>> It gives me an error !!
>> Thanks
>> Aguiar !!!
>>
>>
>
>
>
Attached files Error.log (1.4 KB)Â
-
- Mensajes: 115
- Registrado: Jue Jun 01, 2006 7:21 pm
Report
Ignacio,
Thank you for your answer, but it still report the same error...maybe it's
another problem...Can you help ?
Thanks.
Aguiar !!!
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escreveu na mensagem
news:44ae1276$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Aguiar,
>
> No, is not the right way because nFor value is always equal to
> Len(::oDbfaFields) and this happens because nFor is inside a code-block,
> if
> you change nFor, when the code-block is evaluated it will use the current
> value, not the old value that it had when you create the code-block.
>
> In order to avoid this problem you should create code-block with detached
> locals. Here is a sample:
>
> With Object oCol := TRptColumn():New()
> :aTitle := GenBlockForTitle( ::oDbf, nFor )
> End
>
> FUNCTION GenBlockForTitle( oDataSet, nFor )
>
> RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
>
> Regards,
>
> "Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
> news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> Hi
>>
>> Is this the right way to print a generic Dataset report ? :
>>
>> With Object ::oDbf
>> :Select()
>> :SaveState(.T.)
>> :Gotop()
>> End
>> REPORT oReport ;
>> TITLE ::oDbf:cName ;
>> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
>> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
>> PREVIEW ;
>> FONT oFont1, oFont2
>>
>> For nFor := 1 To Len(::oDbf:aFields)-1
>> With Object oCol := TRptColumn():New()
>> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
>> :aData := {{||::oDbf:aFields[nFor]:Value}}
>> :nDataFont := 2
>> :oReport := oReport
>> End
>> oReport:AddColumn(oCol)
>> Next
>>
>> RUN REPORT oReport
>> ::oDbf:RestoreState(.T.)
>>
>> It gives me an error !!
>> Thanks
>> Aguiar !!!
>>
>>
>
>
>
Attached files Error.log (1.4 KB)Â
Thank you for your answer, but it still report the same error...maybe it's
another problem...Can you help ?
Thanks.
Aguiar !!!
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escreveu na mensagem
news:44ae1276$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Aguiar,
>
> No, is not the right way because nFor value is always equal to
> Len(::oDbfaFields) and this happens because nFor is inside a code-block,
> if
> you change nFor, when the code-block is evaluated it will use the current
> value, not the old value that it had when you create the code-block.
>
> In order to avoid this problem you should create code-block with detached
> locals. Here is a sample:
>
> With Object oCol := TRptColumn():New()
> :aTitle := GenBlockForTitle( ::oDbf, nFor )
> End
>
> FUNCTION GenBlockForTitle( oDataSet, nFor )
>
> RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
>
> Regards,
>
> "Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
> news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> Hi
>>
>> Is this the right way to print a generic Dataset report ? :
>>
>> With Object ::oDbf
>> :Select()
>> :SaveState(.T.)
>> :Gotop()
>> End
>> REPORT oReport ;
>> TITLE ::oDbf:cName ;
>> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
>> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
>> PREVIEW ;
>> FONT oFont1, oFont2
>>
>> For nFor := 1 To Len(::oDbf:aFields)-1
>> With Object oCol := TRptColumn():New()
>> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
>> :aData := {{||::oDbf:aFields[nFor]:Value}}
>> :nDataFont := 2
>> :oReport := oReport
>> End
>> oReport:AddColumn(oCol)
>> Next
>>
>> RUN REPORT oReport
>> ::oDbf:RestoreState(.T.)
>>
>> It gives me an error !!
>> Thanks
>> Aguiar !!!
>>
>>
>
>
>
Attached files Error.log (1.4 KB)Â
- ignacio
- Site Admin
- Mensajes: 9259
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Report
Aguiar,
Please send us a small sample. Impossible to help you with the information
given.
Regards,
"Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
news:44ae2dcb$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Ignacio,
> Thank you for your answer, but it still report the same error...maybe it's
> another problem...Can you help ?
> Thanks.
> Aguiar !!!
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escreveu na mensagem
> news:44ae1276$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> Aguiar,
>>
>> No, is not the right way because nFor value is always equal to
>> Len(::oDbfaFields) and this happens because nFor is inside a code-block,
>> if
>> you change nFor, when the code-block is evaluated it will use the current
>> value, not the old value that it had when you create the code-block.
>>
>> In order to avoid this problem you should create code-block with detached
>> locals. Here is a sample:
>>
>> With Object oCol := TRptColumn():New()
>> :aTitle := GenBlockForTitle( ::oDbf, nFor )
>> End
>>
>> FUNCTION GenBlockForTitle( oDataSet, nFor )
>>
>> RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
>>
>> Regards,
>>
>> "Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
>> news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>> Hi
>>>
>>> Is this the right way to print a generic Dataset report ? :
>>>
>>> With Object ::oDbf
>>> :Select()
>>> :SaveState(.T.)
>>> :Gotop()
>>> End
>>> REPORT oReport ;
>>> TITLE ::oDbf:cName ;
>>> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
>>> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
>>> PREVIEW ;
>>> FONT oFont1, oFont2
>>>
>>> For nFor := 1 To Len(::oDbf:aFields)-1
>>> With Object oCol := TRptColumn():New()
>>> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
>>> :aData := {{||::oDbf:aFields[nFor]:Value}}
>>> :nDataFont := 2
>>> :oReport := oReport
>>> End
>>> oReport:AddColumn(oCol)
>>> Next
>>>
>>> RUN REPORT oReport
>>> ::oDbf:RestoreState(.T.)
>>>
>>> It gives me an error !!
>>> Thanks
>>> Aguiar !!!
>>>
>>>
>>
>>
>>
>
>
>
Please send us a small sample. Impossible to help you with the information
given.
Regards,
"Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
news:44ae2dcb$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Ignacio,
> Thank you for your answer, but it still report the same error...maybe it's
> another problem...Can you help ?
> Thanks.
> Aguiar !!!
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escreveu na mensagem
> news:44ae1276$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> Aguiar,
>>
>> No, is not the right way because nFor value is always equal to
>> Len(::oDbfaFields) and this happens because nFor is inside a code-block,
>> if
>> you change nFor, when the code-block is evaluated it will use the current
>> value, not the old value that it had when you create the code-block.
>>
>> In order to avoid this problem you should create code-block with detached
>> locals. Here is a sample:
>>
>> With Object oCol := TRptColumn():New()
>> :aTitle := GenBlockForTitle( ::oDbf, nFor )
>> End
>>
>> FUNCTION GenBlockForTitle( oDataSet, nFor )
>>
>> RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
>>
>> Regards,
>>
>> "Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
>> news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>> Hi
>>>
>>> Is this the right way to print a generic Dataset report ? :
>>>
>>> With Object ::oDbf
>>> :Select()
>>> :SaveState(.T.)
>>> :Gotop()
>>> End
>>> REPORT oReport ;
>>> TITLE ::oDbf:cName ;
>>> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
>>> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
>>> PREVIEW ;
>>> FONT oFont1, oFont2
>>>
>>> For nFor := 1 To Len(::oDbf:aFields)-1
>>> With Object oCol := TRptColumn():New()
>>> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
>>> :aData := {{||::oDbf:aFields[nFor]:Value}}
>>> :nDataFont := 2
>>> :oReport := oReport
>>> End
>>> oReport:AddColumn(oCol)
>>> Next
>>>
>>> RUN REPORT oReport
>>> ::oDbf:RestoreState(.T.)
>>>
>>> It gives me an error !!
>>> Thanks
>>> Aguiar !!!
>>>
>>>
>>
>>
>>
>
>
>
Report
Aguiar,
Please send us a small sample. Impossible to help you with the information
given.
Regards,
"Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
news:44ae2dcb$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Ignacio,
> Thank you for your answer, but it still report the same error...maybe it's
> another problem...Can you help ?
> Thanks.
> Aguiar !!!
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escreveu na mensagem
> news:44ae1276$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> Aguiar,
>>
>> No, is not the right way because nFor value is always equal to
>> Len(::oDbfaFields) and this happens because nFor is inside a code-block,
>> if
>> you change nFor, when the code-block is evaluated it will use the current
>> value, not the old value that it had when you create the code-block.
>>
>> In order to avoid this problem you should create code-block with detached
>> locals. Here is a sample:
>>
>> With Object oCol := TRptColumn():New()
>> :aTitle := GenBlockForTitle( ::oDbf, nFor )
>> End
>>
>> FUNCTION GenBlockForTitle( oDataSet, nFor )
>>
>> RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
>>
>> Regards,
>>
>> "Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
>> news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>> Hi
>>>
>>> Is this the right way to print a generic Dataset report ? :
>>>
>>> With Object ::oDbf
>>> :Select()
>>> :SaveState(.T.)
>>> :Gotop()
>>> End
>>> REPORT oReport ;
>>> TITLE ::oDbf:cName ;
>>> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
>>> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
>>> PREVIEW ;
>>> FONT oFont1, oFont2
>>>
>>> For nFor := 1 To Len(::oDbf:aFields)-1
>>> With Object oCol := TRptColumn():New()
>>> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
>>> :aData := {{||::oDbf:aFields[nFor]:Value}}
>>> :nDataFont := 2
>>> :oReport := oReport
>>> End
>>> oReport:AddColumn(oCol)
>>> Next
>>>
>>> RUN REPORT oReport
>>> ::oDbf:RestoreState(.T.)
>>>
>>> It gives me an error !!
>>> Thanks
>>> Aguiar !!!
>>>
>>>
>>
>>
>>
>
>
>
Please send us a small sample. Impossible to help you with the information
given.
Regards,
"Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
news:44ae2dcb$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Ignacio,
> Thank you for your answer, but it still report the same error...maybe it's
> another problem...Can you help ?
> Thanks.
> Aguiar !!!
>
> "Ignacio Ortiz de Zúñiga" <NoName@xailer.com> escreveu na mensagem
> news:44ae1276$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>> Aguiar,
>>
>> No, is not the right way because nFor value is always equal to
>> Len(::oDbfaFields) and this happens because nFor is inside a code-block,
>> if
>> you change nFor, when the code-block is evaluated it will use the current
>> value, not the old value that it had when you create the code-block.
>>
>> In order to avoid this problem you should create code-block with detached
>> locals. Here is a sample:
>>
>> With Object oCol := TRptColumn():New()
>> :aTitle := GenBlockForTitle( ::oDbf, nFor )
>> End
>>
>> FUNCTION GenBlockForTitle( oDataSet, nFor )
>>
>> RETURN { {|| oDataSet:aField[ nFor ]:cTitle } }
>>
>> Regards,
>>
>> "Aguiar" <aguiar.costa@sisbit.pt> escribió en el mensaje
>> news:44ad70b6$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
>>> Hi
>>>
>>> Is this the right way to print a generic Dataset report ? :
>>>
>>> With Object ::oDbf
>>> :Select()
>>> :SaveState(.T.)
>>> :Gotop()
>>> End
>>> REPORT oReport ;
>>> TITLE ::oDbf:cName ;
>>> FOOTER "Página: " + AllTrim( Str( oReport:nPage ) )+;
>>> " "+DToC(Date())+" "+Time() ALIGN taCENTER ;
>>> PREVIEW ;
>>> FONT oFont1, oFont2
>>>
>>> For nFor := 1 To Len(::oDbf:aFields)-1
>>> With Object oCol := TRptColumn():New()
>>> :aTitle := {{||::oDbf:aFields[nFor]:cName}}
>>> :aData := {{||::oDbf:aFields[nFor]:Value}}
>>> :nDataFont := 2
>>> :oReport := oReport
>>> End
>>> oReport:AddColumn(oCol)
>>> Next
>>>
>>> RUN REPORT oReport
>>> ::oDbf:RestoreState(.T.)
>>>
>>> It gives me an error !!
>>> Thanks
>>> Aguiar !!!
>>>
>>>
>>
>>
>>
>
>
>