Page 1 of 1

fieldWBlock

Posted: Tue Nov 17, 2020 12:57 pm
by Silvio.Falconi
I not understood how work fieldWBlock
before run ok and now not run

I wish print a field using fieldWBlock

Code: Select all

#include "fivewin.ch"

REQUEST DBFCDX


Function test()
 local acampi :=   {"FIRST"   ,;
                      "LAST"    ,;
                      "STREET"  ,;
                      "CITY"    ,;
                      "STATE"   ,;
                      "ZIP"     ,;
                      "HIREDATE",;
                      "MARRIED" ,;
                      "AGE"     ,;
                      "SALARY"  ,;
                      "NOTES"    }

local nFor:=1// first
 local oPrn
local oFont
local oBold

 USE CUSTOMER NEW alias cust SHARED VIA "DBFCDX"


PRINT oPrn PREVIEW

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14 OF oPrn
   DEFINE FONT oBold NAME "VERDANA" SIZE 0,-25 BOLD OF oPrn

   PAGE

    @ 10, 10 PRINT TO oPrn TEXT bCampo( aCampi, nFor,1 ) ;
                SIZE 100, 100 CM ALIGN "T" FONT oFont

      ENDPAGE
       ENDPRINT

   RELEASE FONT oFont, oBold


return nil

function bCampo( aCampi, nFor,nArea )
   return (fieldWBlock(aCampi[nFor],nArea ))

 
I tried also with fieldWBlock( "FIRST",1 )

Re: fieldWBlock

Posted: Tue Nov 17, 2020 2:10 pm
by ADutheil
Try
eval(fieldWBlock(aCampi[nFor],nArea ))

Re: fieldWBlock

Posted: Tue Nov 17, 2020 5:07 pm
by Silvio.Falconi
perhaps fieldget(n)
but I need to have the naArea

Re: fieldWBlock

Posted: Tue Nov 17, 2020 8:53 pm
by karinha

Re: fieldWBlock

Posted: Wed Nov 18, 2020 2:53 pm
by Silvio.Falconi
nCampo:= 2
aFields := {"FIRST" ,;
"LAST" ,;
"STREET" ,;
"CITY" ,;
"STATE" ,;
"ZIP" ,;
"HIREDATE",;
"MARRIED" ,;
"AGE" ,;
"SALARY" ,;
"NOTES" }



this Run ok if I wish print a barcode

Code: Select all

nCampo:= 2
FIELDWBLOCK( ncampo, SELECT( "CUST" ) )
sample :

@ nRiga, nColonna PRINT TO oPrn TEXT FIELDWBLOCK( ncampo, SELECT( "CUST" ) ) ;
AS BARCODE TYPE "EAN8" ;
SIZE nWid-nCo, nHei CM BARSIZE nWid


If I wish print a text run with

Code: Select all

 FIELDWBLOCK( aFields[nCampo], SELECT( "CUST" ) )
sample :

@ nRiga, nColonna PRINT TO oPrn TEXT FIELDWBLOCK( aFields[ncampo], SELECT( "CUST" ) );
SIZE nWid, nHei CM ALIGN "T" FONT oFnt


it's very strange because I call allways the field number 2 ( Last)

Re: fieldWBlock

Posted: Wed Nov 18, 2020 4:58 pm
by ADutheil
FIELDWBLOCK("FName", 1) is the same as &( "{ |setVal| IF( setVal == NIL, 1->FName, 1->FName := setVal ) }" )

If you don't eval the block you'll not retrieve the content of the field.

@ nRiga, nColonna PRINT TO oPrn TEXT eval( FIELDWBLOCK( aFields[ncampo], SELECT( "CUST" ) ) );
SIZE nWid, nHei CM ALIGN "T" FONT oFnt

Re: fieldWBlock

Posted: Wed Nov 18, 2020 6:24 pm
by Silvio.Falconi
ADutheil wrote:FIELDWBLOCK("FName", 1) is the same as &( "{ |setVal| IF( setVal == NIL, 1->FName, 1->FName := setVal ) }" )

If you don't eval the block you'll not retrieve the content of the field.

@ nRiga, nColonna PRINT TO oPrn TEXT eval( FIELDWBLOCK( aFields[ncampo], SELECT( "CUST" ) ) );
SIZE nWid, nHei CM ALIGN "T" FONT oFnt
I tried with eval make error

Re: fieldWBlock

Posted: Wed Nov 18, 2020 8:27 pm
by ADutheil
I took your initial example and rewrote a little:

Code: Select all

#include "fivewin.ch"

REQUEST DBFCDX


Function main()
 local acampi :=   {"FIRST"   ,;
                      "LAST"    ,;
                      "STREET"  ,;
                      "CITY"    ,;
                      "STATE"   ,;
                      "ZIP"     ,;
                      "HIREDATE",;
                      "MARRIED" ,;
                      "AGE"     ,;
                      "SALARY"  ,;
                      "NOTES"    }

local nFor:=2

USE CUSTOMER NEW alias cust SHARED VIA "DBFCDX"


alert(  bCampo( aCampi, nFor,1 ) )


return nil

function bCampo( aCampi, nFor,nArea )
   return eval((fieldWBlock(aCampi[nFor],nArea )))
 
I works OK for me. The alert box shows Simpson

Re: fieldWBlock

Posted: Wed Nov 18, 2020 8:34 pm
by ADutheil
This works perfectly for me.

Code: Select all

#include "fivewin.ch"

REQUEST DBFCDX


Function main()
 local acampi :=   {"FIRST"   ,;
                      "LAST"    ,;
                      "STREET"  ,;
                      "CITY"    ,;
                      "STATE"   ,;
                      "ZIP"     ,;
                      "HIREDATE",;
                      "MARRIED" ,;
                      "AGE"     ,;
                      "SALARY"  ,;
                      "NOTES"    }

local nFor:=2

 local oPrn
local oFont
local oBold

 USE CUSTOMER NEW alias cust SHARED VIA "DBFCDX"


PRINT oPrn PREVIEW

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14 OF oPrn
   DEFINE FONT oBold NAME "VERDANA" SIZE 0,-25 BOLD OF oPrn

   PAGE

    @ 10, 10 PRINT TO oPrn TEXT bCampo( aCampi, nFor,1 ) FONT oFont

      ENDPAGE
       ENDPRINT

   RELEASE FONT oFont, oBold


return nil

function bCampo( aCampi, nFor,nArea )
   return eval((fieldWBlock(aCampi[nFor],nArea )))

 

Re: fieldWBlock

Posted: Fri Nov 20, 2020 7:35 am
by Silvio.Falconi
ADutheil wrote:This works perfectly for me.

Code: Select all

#include "fivewin.ch"

REQUEST DBFCDX


Function main()
 local acampi :=   {"FIRST"   ,;
                      "LAST"    ,;
                      "STREET"  ,;
                      "CITY"    ,;
                      "STATE"   ,;
                      "ZIP"     ,;
                      "HIREDATE",;
                      "MARRIED" ,;
                      "AGE"     ,;
                      "SALARY"  ,;
                      "NOTES"    }

local nFor:=2

 local oPrn
local oFont
local oBold

 USE CUSTOMER NEW alias cust SHARED VIA "DBFCDX"


PRINT oPrn PREVIEW

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14 OF oPrn
   DEFINE FONT oBold NAME "VERDANA" SIZE 0,-25 BOLD OF oPrn

   PAGE

    @ 10, 10 PRINT TO oPrn TEXT bCampo( aCampi, nFor,1 ) FONT oFont

      ENDPAGE
       ENDPRINT

   RELEASE FONT oFont, oBold


return nil

function bCampo( aCampi, nFor,nArea )
   return eval((fieldWBlock(aCampi[nFor],nArea )))

 
Also for me !!
When I tried to Print a BARCODE it make error
IT's very STRANGE because Barcode want code as text

sample

Code: Select all

nWid:=0.2
@ 10, 10 PRINT TO oPrn TEXT  bCampo( aCampi, nFor,1 );
AS BARCODE TYPE "EAN8" ;
SIZE 3.6, 0.8  CM BARSIZE nWid

Re: fieldWBlock

Posted: Sat Nov 21, 2020 8:18 pm
by ADutheil
My FWH version is old and I'm not aware of the AS BARCODE command so I can't help you further.

Re: fieldWBlock

Posted: Mon Nov 23, 2020 8:06 pm
by Silvio.Falconi
THERE IS SOMEONE CAN HELP ME PLS ?

Re: fieldWBlock

Posted: Tue Nov 24, 2020 1:49 pm
by ADutheil
As you want to print a barcode the function may be expecting a string of numbers not letters.

Re: fieldWBlock

Posted: Tue Nov 24, 2020 6:51 pm
by Silvio.Falconi
ADutheil wrote:As you want to print a barcode the function may be expecting a string of numbers not letters.
I allready tried