Focal Point
[SOLVED] Converting A5 field to Integer

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4297063036

April 23, 2013, 09:58 AM
wlwright1
[SOLVED] Converting A5 field to Integer
I am fairly new to WF so excuse me if I am asking a dumb question. I searched the forums and only found converting dates to integers. I have a A5 field that we use to symbolize a specific error; ie ADD. I am looking to get a count of flags for a specific group of people and then sort descending.

Here is the code I am using right now with an edit in a define:
DEFINE FILE T_DB_ERROR_CNT
Flag_num/I6C=EDIT(T_DB_ERROR_CNT.T_DB_ERROR_CNT.FLAG);
FLAG_COUNT/I5C=IF Flag_num GE 1 THEN 1 ELSE 0;
END

Can someone take a look and help me out with this?

This message has been edited. Last edited by: <Kathryn Henning>,


8.1.0.4
Windows 7
Excel, AHTML, HTML,PDF
April 23, 2013, 10:38 AM
Rao D
ATODBL(source_string, length, output)

The above function converts Alpha field to Numeric


WebFOCUS - ver8201
[ReportingServers: Windows 64bit;
Client: tomcat and IIS on windows 2012
AppStudio

April 23, 2013, 12:53 PM
Danny-SRL
Warren,
What does your FLAG field contain? Numbers? Alpha values? I ask because of your "i.e. ADD".


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

April 23, 2013, 02:38 PM
wlwright1
The field could have numeric and alpha characters or a combination
Some choices would be:
ADD
311
Y01


8.1.0.4
Windows 7
Excel, AHTML, HTML,PDF
April 23, 2013, 03:18 PM
Danny-SRL
quote:
T_DB_ERROR_CNT.T_DB_ERROR_CNT.FLAG

This field being ALPHA, the EDIT function will return 0 when the contents is not a number.
So, if you SUM your Flag_num field you will get the number of FLAGs containing numbers only.
Is that what you wanted?


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

April 23, 2013, 03:34 PM
wlwright1
No i want it for all of them whether they have numbers or not. I think that is what my issue is that it is just doing the ones with numbers. Is there a way to get those that have just ALPHA in them as well?


8.1.0.4
Windows 7
Excel, AHTML, HTML,PDF
April 23, 2013, 03:51 PM
Tom Flynn
Use CHKFMT function.
In Dev Studio, click on Help, Contents, Search, type in CHKFMT, 1st listing...
hth


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
April 23, 2013, 04:18 PM
wlwright1
Tom - thanks I have tried as you suggested with the code below but when i run it the report is showing 0's all the way down for each flag.

COMPUTE FLAG_COUNT/I3 = CHKFMT(3, T_DB_ERROR_CNT.T_DB_ERROR_CNT.FLAG, 'XXX',FLAG_COUNT);

I could do a IF statement for flag saying that if FLAG_COUNT EQ 0 THEN 1 ELSE 0. Would that work?

Actually tried this and it goes back to the original issue that it counts everything that has ALPHA characters as a '1' but everything with a number as '0'


8.1.0.4
Windows 7
Excel, AHTML, HTML,PDF
April 23, 2013, 05:06 PM
wlwright1
I actually have resolved this. How do I close a thread on the forum?


8.1.0.4
Windows 7
Excel, AHTML, HTML,PDF
April 24, 2013, 12:52 AM
FrankDutch
Try this

DEFINE FILE XXXX

NUM/I7=IF FLAG EQ 'ADD' THEN 1 ELSE 0;

END

TABLE FILE XXXX
SUM NUM
BY WHATEVER
END

or...

TABLE FILE XXXX
SUM CNT.FLAG
BY WHATEVER
ACROSS FLAG
END




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

May 03, 2013, 01:15 PM
<Kathryn Henning>
Hi wlwright1,

To close a thread on the forum, please reference Rule and Best Practices: Tag Your Topic with Keywords.

I've taken care of this one for you. Smiler

Cheers!

Kathryn