May 28, 2007, 04:18 AM
PrasannaConvert Alpha to Number and Store in a numeric field - possible???
All,
I have a requirement where i need to validate a column such a way whenever i found zero in the column then it should say 'N/A' else it has to do the given calculation. I had used FTOA for this.here is the define condition that i used.
COLAB/A15=IF COLA EQ 0 THEN 'N/A' ELSE FTOA((COLA / COLB), '(D12.2-%)', COLAB);
.
But because of this i am getting delay in report,and also for a given condition it gives some junk values.Then in total also i am not able to see the values for the given column.
Is there a way to store the 'N/A' in the numeric feild?If i store 'N/A' as number then there will be any issues in the grand total of the column?
Any sugeestion or existing discussions??
Regards
May 28, 2007, 04:37 AM
FrankDutchPrasanna
If I understand this well the field is an alpha format?
You can say
NEWFIELD/D12.2=EDIT(ALPHAFIELD);
then if the field is real alpha you will get 0, you can now do any calculation on this numeric field
If the field is numeric it depends if it is packed or not
take a look at PTOA for this.
Use FIND in the focalpoint forum to find other questions and solutions on this issue.
have a nice day....
May 28, 2007, 04:52 AM
PrasannaFrank,
I need it in other way around. If the column data has 0 then the column should display N/A, else i need to get the calculation of the define.
Regards
May 28, 2007, 05:04 AM
Alan BTry a DEFINE:
SET NODATA='N/A'
DEFINE FILE Fn
miss_field/D12.2 MISSING ON = IF field EQ 0 THEN MISSING ELSE field;
calc_field/D12.2 MISSING ON = calculation on miss_field;
END
TABLE FILE Fn
PRINT field miss-field calc_field
.
.
END