How can I show an empty numeric field without a zero

How can I show an empty numeric field without a zero

Postby Jules de Pierre » Mon May 01, 2006 6:09 pm

Hi All,
In an app I have numeric fields in which no result of earlier actions are known yet.
In an TsBrowse presentation I want no "zero" in the field but an empty field presentation.
Dbases tend to put a zero in a numeric field, but in certain cases there is no value available yet.

How can I force that field into an empty field.

Thanks,

Jules
Jules de Pierre
 
Posts: 21
Joined: Mon Mar 20, 2006 12:48 pm
Location: Netherlands

Re: How can I show an empty numeric field without a zero

Postby Enrico Maria Giordano » Mon May 01, 2006 7:16 pm

Just use

TRANSFORM( "@Z ...", FIELD -> number )

as browse column expression or directly

PICTURE "@Z ..."

if your browse supports it.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Jules de Pierre » Mon May 01, 2006 9:02 pm

Enrico,
Thanks for advising me.
I am not able to do the right thing with it.
I will give some more specific info.
I use TsBrowse with Add Column

ADD COLUMN TO oBrw[ 1 ];
HEADER "Runs2" ;
SIZE 50 PIXELS ;
DATA FieldWblock("Uitslag2", Select());
COLORS CLR_YELLOW,CLR_BLUE;
ALIGN DT_CENTER

When nUitslag2 == 0 it should display a blank field.

Is that possible or should I change the next line in a Resource?

REDEFINE GET onUitslag2 VAR nUitslag2 ID 105 OF oDlwBew UPDATE Picture "999"

Thanks,

Jules
Jules de Pierre
 
Posts: 21
Joined: Mon Mar 20, 2006 12:48 pm
Location: Netherlands

Postby Enrico Maria Giordano » Tue May 02, 2006 6:38 am

Try
ADD COLUMN TO oBrw[ 1 ];
HEADER "Runs2" ;
SIZE 50 PIXELS ;
DATA FieldWblock("Uitslag2", Select());
COLORS CLR_YELLOW,CLR_BLUE;
ALIGN DT_CENTER;
PICTURE "@Z 999"

or, if that command doesn't support PICTURE clause

DATA TRANSFORM( "@Z 999", FIELD -> Uitslag2 );

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Jules de Pierre » Tue May 02, 2006 11:30 pm

Enrico,
This works OK:

ADD COLUMN TO oBrw[ 1 ];
HEADER "Runs2" ;
SIZE 50 PIXELS ;
DATA FieldWblock("Uitslag2", Select());
COLORS CLR_YELLOW,CLR_BLUE;
ALIGN DT_CENTER;
PICTURE "@Z 999"


TsBrowse does not recognize Transform in this place

DATA TRANSFORM( "@Z 999", FIELD -> Uitslag2 );

However in my database I have to differentiate between certain records with a different field content to show zero's or blanks.

It does not work when I use :
If Gesp == "J"
Add Column etc
Picture "@Z 999"
Else
Add Column etc
Endif

So it is all blanks or zero's.
I need both depending on field Gesp

Jules
Jules de Pierre
 
Posts: 21
Joined: Mon Mar 20, 2006 12:48 pm
Location: Netherlands

Postby tnhoe » Wed May 03, 2006 1:54 pm

ADD COLUMN ...
:
:
PICTURE if(Gesp='J','@Z 999','999')
Regards

Hoe, email: easywin3@yahoo.com
User avatar
tnhoe
 
Posts: 83
Joined: Tue Nov 08, 2005 11:09 am
Location: Malaysia

Postby Jules de Pierre » Wed May 03, 2006 11:07 pm

Great TNHOE,

It works perfectly.
Thanks,

Jules
Jules de Pierre
 
Posts: 21
Joined: Mon Mar 20, 2006 12:48 pm
Location: Netherlands


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 47 guests