Page 1 of 1
Write a Block
Posted: Wed Jun 26, 2019 6:52 am
by Silvio.Falconi
I need to return from a function a codeBlock type
{|| oCustomer:First }
but I Know the oDbf ( tdatabase ) and I have an array where are the fields of this archive
so I have :
Function bCampo( aCampos, nFor,oDbf)
return oDbf:fieldWBlock(aCampos[nFor] )
but this expression
oDbf:fieldWBlock(aCampos[nFor] ) not run ok
it not make error and then on Report I have a white list
I have this problem using Tdatabase with normal Use it run ok
how I can resolve ?
Re: Write a Block
Posted: Wed Jun 26, 2019 2:16 pm
by nageswaragunupudi
We suggest this approach for making reports using TDatabase.
Code: Select all
local oRep, oStates
oStates := TDatabase():Open( nil, "STATES", "DBFCDX", .T. )
oStates:GoTop()
REPORT oRep PREVIEW
COLUMN TITLE "CODE" DATA oStates:Code
COLUMN TITLE "NAME" DATA oStates:name
ENDREPORT
oRep:bSkip := { || oStates:Skip( 1 ) }
ACTIVATE REPORT oRep WHILE !oStates:Eof()
oStates:End()
If you do not want a simple, straightforward and reliable approach and you insist on complicating your programs it is up to you.
Re: Write a Block
Posted: Wed Jun 26, 2019 3:07 pm
by nageswaragunupudi
FieldWBlock( cFieldName, oDbf:nArea )
Re: Write a Block
Posted: Thu Jun 27, 2019 10:16 am
by Silvio.Falconi
I made
function bCampo2( aFields, nFor,oDbf)
return oDbf:fieldWBlock(aField[nFor] )
and seem run , it's wrong ?
>If you do not want a simple, straightforward and reliable approach and you insist on complicating your programs it is up to you.
I don't complicate my life, it's just that for years I've used functions to fend off prints, for example, and now in my head it's saved somewhere in the memory that I have to use those commands to make prints, it's as if it came automatically and if I do something that my memory refuses it creates problems and as you say I complicate my life ... and I do all kinds of mess !! but you, I know you love me, you are patient with me,allways!!!
Re: Write a Block
Posted: Thu Jun 27, 2019 11:52 am
by nageswaragunupudi
Code: Select all
function bCampo2( aFields, nFor,oDbf)
return fieldWBlock( aField[nFor], oDbf:nArea )
I still advise you to use the sample I posted and please change your habit.