I recently use the Macgyver technique to work around a MAX Verb issue. So I have two sets of computes that help me pivot my field names as well as their values to go from:
STATE metric_a metric_b metric_c
NY 5 13.4 $14.54
To this
STATE NY
metric_a 5
metric_b 13.4
metric_c 14.45
In some cases I want a decimal and in some I don't. Each metric had its own rules and has been pre-rounded to the correct precision prior to this. I have tried using PTOA and FTOA but it seems to want to make the converge to one format. This means my numbers that make no sense with .00 end up with them because that is the largest precision for another metric.
How do I tell it not to care and just make it a string regardless of precision?
It looks like on the pivot from the MacGyver if I were to do all new defines that to FTOA from each format to a string it would retain any numeric format. YIKES
Is there an easier way without telling it all 35 metric precision types?
You can change the format in the FTOA and PTOA function on the fly.
Try something like this:
DEFINE FILE CAR
FMT/A10 =
IF RETAIL_COST GE 10000 THEN '(D12.2)' ELSE
IF RETAIL_COST LT 10000 AND RETAIL_COST GE 5000 THEN '(D12.1)' ELSE '(D12)';
TEXT/A20 = FTOA(RETAIL_COST,FMT,TEXT);
END
-RUN
TABLE FILE CAR
PRINT
FMT
RETAIL_COST
TEXT
BY CAR
END
-RUN
December 09, 2005, 01:14 PM
JimRice
Here's an example where all your metrics would be in a subfoot.
DEFINE FILE CAR
M_CNT/I3 = 1;
M_SEAT/D5.1 = SEATS;
M_COST/D9.2M = RETAIL_COST;
M_FUEL/D7.2 = FUEL_CAP;
M_HEAD/A21 = 'CAR: ' | CAR;
END
TABLE FILE CAR
SUM
M_CNT NOPRINT
BY M_HEAD AS ''
ON M_HEAD NOSPLIT
ON M_HEAD SUBFOOT
" METRIC A - # OF MODELS: <M_CNT "
" METRIC B - AVE. # SEATS: <AVE.M_SEAT "
" METRIC C - AVE. RET COST: <AVE.M_COST "
" METRIC D - AVE. FUEL CAP: <AVE.M_FUEL "
" "
ON TABLE SET ONLINE-FMT PDF
ON TABLE SET STYLE *
TYPE=REPORT,
FONT='TIMES',
SIZE=9,
ORIENTATION=PORTRAIT,$
-*
TYPE=SUBFOOT,OBJECT=TEXT, JUSTIFY=LEFT,WIDTH=1.850,$
TYPE=SUBFOOT,OBJECT=FIELD,JUSTIFY=RIGHT,WIDTH=0.750,$
-*
ENDSTYLE
END
JimThis message has been edited. Last edited by: Kerry,
WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
December 09, 2005, 01:22 PM
JimRice
You will need to add the following fields to the subfoot lines of the previous post.
M_CNT AVE.M_SEAT AVE.M_COST AVE.M_FUEL
They didn't show up when I pasted them into the post.