Write a Block

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Write a Block

Post 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
Image

I have this problem using Tdatabase with normal Use it run ok

how I can resolve ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Write a Block

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Write a Block

Post by nageswaragunupudi »

FieldWBlock( cFieldName, oDbf:nArea )
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Write a Block

Post 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!!!
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Write a Block

Post 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.
Regards

G. N. Rao.
Hyderabad, India
Post Reply