fieldWBlock

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

fieldWBlock

Post 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 )
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: fieldWBlock

Post by ADutheil »

Try
eval(fieldWBlock(aCampi[nFor],nArea ))
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: fieldWBlock

Post by Silvio.Falconi »

perhaps fieldget(n)
but I need to have the naArea
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: fieldWBlock

Post by karinha »

João Santos - São Paulo - Brasil
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: fieldWBlock

Post 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)
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: fieldWBlock

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

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: fieldWBlock

Post 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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: fieldWBlock

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

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: fieldWBlock

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

 
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: fieldWBlock

Post 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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: fieldWBlock

Post by ADutheil »

My FWH version is old and I'm not aware of the AS BARCODE command so I can't help you further.
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: fieldWBlock

Post by Silvio.Falconi »

THERE IS SOMEONE CAN HELP ME PLS ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: fieldWBlock

Post by ADutheil »

As you want to print a barcode the function may be expecting a string of numbers not letters.
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: fieldWBlock

Post 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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply