Format of decimal in browse

Beeb

Member
Hello,

Can anybody give me tip about the following?
I want to see the value of a decimal in a browse, but only when the value <> 0, otherwise i just want to browse cell to be empty.
I thought to define a format for this field: format ">>.>>". (with two decimals) but this doesn't work.
Strange enough format ">>" works fine but then i have no decimals.

Does anybody knows which format to use or how to solve this in another way?
I work with progress 9.1D

Thanks!

Elise
 
Create a calculated column

IF (<table>.<field> = 0 ) THEN ("") ELSE (STRING(<table>.<field>,">>9.99")) @ cField


cField is a CHAR VARIABLE that you declare at the start of your program , progress uses it to display the value in the browser.
 
i'm sorry .. but where do i put this code?
My browse is dynamic browse.

now i do this:
ASSIGN hField = table-name:BUFFER-FIELD("productie")
hField:FORMAT = ">9.99".
.. in the procedure where i create my browse:

CREATE BROWSE dyn-browse-pers
ASSIGN WIDTH = 176.60
HEIGHT = 11.5
EXPANDABLE = TRUE
COLUMN = 1
ROW = 1
FRAME = FRAME frm_personeel:HANDLE
READ-ONLY = FALSE
SENSITIVE = TRUE
SEPARATORS = TRUE
ROW-MARKERS = TRUE
VISIBLE = TRUE
COLUMN-RESIZABLE = TRUE
TRIGGERS:
ON ROW-DISPLAY PERSISTENT RUN persCol.
ON ROW-LEAVE PERSISTENT RUN upd_pers.
ON 'RIGHT-MOUSE-CLICK' PERSISTENT RUN rightPers.
END.

after this i add al the collumns ect..

Do i have to put it in the row-display?

thanks,

Elise



Create a calculated column

IF (<table>.<field> = 0 ) THEN ("") ELSE (STRING(<table>.<field>,">>9.99")) @ cField


cField is a CHAR VARIABLE that you declare at the start of your program , progress uses it to display the value in the browser.
 
You need to make the Query a free form query and then put it in the DISPLAY trigger, which really isn't a trigger at all but thats progress for ya. I think thats were Franco was going with that.
 
In a dynamic Browse you can do it like this:

DEF VAR hCalcCol AS HANDLE.


/*** DEFINE BROWSER HERE ***/


ON ROW-DISPLAY OF dyn-browse-pers DO:
IF VALID-HANDLE hCalcCol THEN
hColcCol:SCREEN-VALUE = IF <table>.<field> = 0 THEN "" ELSE STRING(<table>.<field>,">>9.99").
END.

hCalcCol = dyn-browse-pers:ADD-CALC-COLUMN("CHARACTER", "X(6)", "0", "LABEL").



Of course this is only a example , you will need to find a way to pass the handle of your calc column to your procedure that does the row display so it knows wich column to display this in.
 
Back
Top