Subject Re: [firebird-support] data display problems
Author Alan Davies
Thanks Helen
That worked a treat and has saved a lot of head-scratching.
The view worked straightaway. I am using vlpad from the fudlib
functions to pad out the field - I have amended it to 12 chars not 254.
The stored procedure did not - it still showed absolute data e.g. 12.1
not 12.10 as I expected.
I have included the correct methods to illustrate the reason why, if
anyone else is interested.
Alan

CREATE VIEW VW_SUPP_DELIVERIES (
SUPP_CODE,
SUPP_NAME,
SUPPLY_TONNES,
SUPPLY_ASH_PC,
SUPPLY_WATER_PC,
SUPPLY_TOTAL_GBP,
SUPPLY_AVG_GBP
) AS

select Supp_Code,Supp_Name,
vlpad(f_fixedpoint(Supply_Tonnes,2),' ',12),
vlpad(f_fixedpoint(Supply_Ash_Pc,1),' ',12),
etc.etc.

CREATE PROCEDURE GET_WEIGHSUPPLIER
(
SUPPCODE INTEGER,
FARMCODE INTEGER,
FROMDATE TIMESTAMP,
UPTODATE TIMESTAMP
)
RETURNS
(
WEIGH_CODE INTEGER,
DATE_IN TIMESTAMP,
TONNES char(12), /*NUMERIC(9, 2),*/
WATER_PC char(12), /*NUMERIC(9, 1),*/
ASH_PC char(12), /*NUMERIC(9, 1),*/
TIME_IN CHAR(5),
TIME_OUT CHAR(5),
HAUL_NAME CHAR(30),
PROD_NAME CHAR(30)
)
AS

begin
for select W.Weigh_Code,W.Date_In,
vlpad(f_fixedpoint(W.Tonnes,2),' ',12),
vlpad(f_fixedpoint(W.Water_Pc,1),' ',12),
vlpad(f_fixedpoint(W.Ash_Pc,1),' ',12),
etc.etc.
>
> But "raw" data displayed on a text device is just strings. If you
don't
> want to parse the output in your application, then probably your only
> choice for this particular requirement is to use a UDF, such as
f_dollarval
> or f_fixedpoint (from FreeUDFLib).
>
> /helen
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------~--
>
> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
> Now with Pop-Up Blocker. Get it for free!
> http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/67folB/TM
> --------------------------------------------------------------------~-
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>

Alan J Davies
Tel: +44 (0)1926 842069
Fax: +44 (0)1926 843755