Page 1 of 1

print a value from dbf (fieldWBlock)

Posted: Mon Nov 08, 2021 12:31 pm
by Silvio.Falconi
I must return me the value of a field on a dbf


Image


this is a small test

Code: Select all | Expand


#include "FiveWin.ch"


REQUEST DBFCDX
     

Function test()
local odbf,cField,ctxt

     oDbf:=TDatabase():Open( , "Customer", "DBFCDX", .T. )
     oDbf:setorder(1)

     cField ="first"
     cField:=trim(cField)          
     ctxt:=bCampo( cfield,oDbf)  //give me an array

?ctxt

return nil

static function bCampo( cCampo,oDbf)
   return   oDbf:fieldWBlock(cCampo )
 



If I made

xbrowser ctxt


I see this

Image

If I made

?ctxt[1] or ?ctxt[1][1]

make error why ?


How I can resolve ?

Re: print a value from dbf (fieldWBlock)

Posted: Tue Nov 09, 2021 12:57 pm
by Antonio Linares
Dear Silvio,

function bCampo() is returning a codeblock and that is what you see (not an array)

Simply evaluate the codeblock providing the parameters

Re: print a value from dbf (fieldWBlock)

Posted: Tue Nov 09, 2021 5:23 pm
by Silvio.Falconi
opps sorry