Página 1 de 1

Report

Publicado: Jue Jul 06, 2006 10:22 pm
por Aguiar Costa
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)Â

Report

Publicado: Vie Jul 07, 2006 9:51 am
por ignacio
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

Publicado: Vie Jul 07, 2006 9:51 am
por NoName
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

Publicado: Vie Jul 07, 2006 11:49 am
por Aguiar Costa
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)Â

Report

Publicado: Vie Jul 07, 2006 11:49 am
por Aguiar Costa
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)Â

Report

Publicado: Vie Jul 07, 2006 6:13 pm
por ignacio
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

Publicado: Vie Jul 07, 2006 6:13 pm
por NoName
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 !!!
>>>
>>>
>>
>>
>>
>
>
>