Page 1 of 1

How can I show an empty numeric field without a zero

Posted: Mon May 01, 2006 6:09 pm
by Jules de Pierre
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

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

Posted: Mon May 01, 2006 7:16 pm
by Enrico Maria Giordano
Just use

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

as browse column expression or directly

PICTURE "@Z ..."

if your browse supports it.

EMG

Posted: Mon May 01, 2006 9:02 pm
by Jules de Pierre
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

Posted: Tue May 02, 2006 6:38 am
by Enrico Maria Giordano
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

Posted: Tue May 02, 2006 11:30 pm
by Jules de Pierre
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

Posted: Wed May 03, 2006 1:54 pm
by tnhoe
ADD COLUMN ...
:
:
PICTURE if(Gesp='J','@Z 999','999')

Posted: Wed May 03, 2006 11:07 pm
by Jules de Pierre
Great TNHOE,

It works perfectly.
Thanks,

Jules