Focal Point
[SOLVED] Ignore alpha string

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

September 10, 2008, 04:42 PM
Tomsweb
[SOLVED] Ignore alpha string
I have a field called PCDOCNUM/A6.
It contains values like '00369' and
'85323' as well as 'ALL' or 'WILSON'.

I cannot find a sample, nor remember how I would accept only those values that are
numeric across the entire string.

How could this be done without coding a very large WHERE statement? Frowner

Thanks!

This message has been edited. Last edited by: Kerry,


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
September 10, 2008, 05:33 PM
GinnyJakes
Tom,

I don't know what release of 7.6 you are running but there is a new function called PATTERN in 7.6.5 (pg. 76 of the SofNF for 765) which might be helpful.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
September 10, 2008, 06:45 PM
susannah
SOOOOOOO cool! thanks Ginny




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
September 11, 2008, 03:13 AM
<JG>
No need to wait for 765

CHKFMT function has been there for ever (almost)
September 11, 2008, 03:53 AM
GamP
But, if you have a leading or trailing space in your alpha field that is otherwise totally numeric, CHKFMT returns a 1 - stating it is not numeric - which is in this case not correct.
You could solve that by using a combination of EDIT and CHKFMT. If the result of the EDIT is 0 and the result of CHKFMT is also 0 then it is definitely not a numeric contents.
The following example show that:
FILEDEF MFD DISK mfd1.mas
-RUN
-WRITE MFD FILENAME=MFD1, SUFFIX=FIX, $
-WRITE MFD SEGNAME=MFD1, $
-WRITE MFD FIELDNAME=COL1 , FORMAT=A6   , ACTUAL=A6, $

FILEDEF MFD1 DISK mfd1.ftm
-RUN
-WRITE MFD1 123456
-WRITE MFD1 all
-WRITE MFD1   9900
-WRITE MFD1 wilson
-WRITE MFD1 000000
-WRITE MFD1   44
-WRITE MFD1 this

TABLE FILE mfd1
PRINT COL1
      COMPUTE COL2/I6 = EDIT(COL1);
      COMPUTE COL3/I6 = CHKFMT(6, COL1, '999999', COL3)
END

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
September 11, 2008, 04:10 PM
Tomsweb
Thanks all for your replies. Nice Thread

Ginny,

I tried the PATTERN function and it worked like a jewel! Good One

Thanks,
Tom


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
September 11, 2008, 04:26 PM
Prarie
Tom will you edit your Subject line and put [SOLVED]?

Thanks
January 09, 2015, 02:27 PM
Doug
Cross reference to : http://forums.informationbuild...1057331/m/7627090276

I added that URL just to make it easy for the next time anyone needs this.