Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] FOCUS command to determine if value is N or A

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] FOCUS command to determine if value is N or A
 Login/Join
 
Master
posted
I'm looking through functions documentation to locate the
FOCUS command to determine if value is N (numeric) or A (aplhanumeric).

Can anyone help ?

Thanks !

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


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report This Post
Master
posted Hide Post
The CHKFMT function will check the format of a string.
 
Posts: 822 | Registered: April 23, 2003Report This Post
Master
posted Hide Post
  

TABLE FILE CAR
PRINT 
MODEL
SALES
DEALER AS 'DEALER'
RETAIL AS 'RETAIL'
COMPUTE BADCHAR/I6 = CHKFMT(6, SALES, '999999', 'I6') ;
-* 
BY COUNTRY
BY CAR
ON TABLE SAVE
END
-RUN
-EXIT



And I get this error...

0 ERROR AT OR NEAR LINE 43 IN PROCEDURE sjustify.fexFOCEXEC *
(FOC36355) INVALID TYPE OF ARGUMENT #2 FOR USER FUNCTION CHKFMT
(FOC009) INCOMPLETE REQUEST STATEMENT
BYPASSING TO END OF COMMAND
-EXIT


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report This Post
Master
posted Hide Post
CHKFMT checks each character, in a character string, for incorrect character types.

Here is a model of how it works:

APP PREPENDPATH IBISAMP
SET ONLINE-FMT = STANDARD
-RUN
DEFINE FILE CAR
 CHARSTRING/A10 = DECODE COUNTRY ('JAPAN'   '1234567890'
                                  'ENGLAND' '123456 123'
	                	         ELSE 'ABC');
 BADCHAR/I2      = CHKFMT(10, CHARSTRING, '999999999', BADCHAR);
 ISANUMBER_YN/A1 = IF BADCHAR EQ 0 THEN 'Y' ELSE 'N';
END
TABLE FILE CAR
 PRINT COUNTRY 
       CHARSTRING
       BADCHAR
       ISANUMBER_YN
END    

Only Japan is flagged as a number:
  COUNTRY     CHARSTRING  BADCHAR  ISANUMBER_YN                                 
  -------     ----------  -------  ------------                                 
  ENGLAND     123456 123        7  N           
  JAPAN       1234567890        0  Y           
  ITALY       ABC               1  N           
  W GERMANY   ABC               1  N           
  FRANCE      ABC               1  N       


CAR.SALES, in your example, is defined as an I6 in the MFD. Is this representative of the field you need to check?

This message has been edited. Last edited by: David Briars,
 
Posts: 822 | Registered: April 23, 2003Report This Post
Virtuoso
posted Hide Post
Or:

  
-* File tomsweb9.fex
DEFINE FILE CAR
TOM/A10=DECODE COUNTRY(
'ENGLAND' '1234567890'
'FRANCE'  '123 456'
'ITALY'   'ASDFG'
'JAPAN'   '0'
ELSE      '56');
END
TABLE FILE CAR
PRINT TOM 
COMPUTE ISNUM/A1=IF TOM EQ '0' THEN 'Y' ELSE IF ATODBL(TOM,'10','D10') EQ 0 THEN 'N' ELSE 'Y';
BY COUNTRY
END


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

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Expert
posted Hide Post
if the variable you want to check is an &var, then just &var.TYPE will produce either an A or an N.
If an &var is all numbers, you'll get an N for its TYPE, no matter how you grabbed it.

&var.TYPE and &var.LENGTH are two handy characteristics




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
Susannah,

Not quite:
quote:

If an &var is all numbers, you'll get an N for its TYPE, no matter how you grabbed it.

Try:
  
-SET &LONGNUM=1234567890123456;
-TYPE &LONGNUM.TYPE

You will get: A


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

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Master
posted Hide Post
And this is a nice one too...


-SET &MINUS='-';
-TYPE &MINUS.TYPE


( it's a N )


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Expert
posted Hide Post
Revisited with an nice insight:

In the case where the CHKFMT function does not work, as when using the SQL1010 adapter, consider the use of the EDIT command.

The EDIT command returns a 0 (zero) if the field is not a numeric field and the numeric value if it is. then check that EDITed field for a zero (which is the value for an alpha field, GT zero is a numeric field.

I hope this helps someone, someday... Smiler




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
hey that works great, doug. i never knew that edit returned a 0 on a /A. Beers on me at Rotiers.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Expert
posted Hide Post
Actually, I just found that out from a newbie... live And Learn...

Rotiers? When? I'll make it there this time...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
Cross reference to : [url=https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5591039892[/url]

I added that URL just to make it easy for the next time anyone needs this.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Master
posted Hide Post
What happens if it is a numeric field and the value happens to be zero .... Mad


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report This Post
Expert
posted Hide Post
IDK... Have you tried it? I've not tried it, yet.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Master
posted Hide Post
We don't use Oracle for starters, and I consult the MFD before writing any code, so I haven't had any reason to try this one. Nice to have in one's back pocket though ...


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report This Post
Virtuoso
posted Hide Post
quote:
TABLE FILE CAR

COMPUTE BADCHAR/I6 = CHKFMT(6, SALES, '999999', 'I6') ;


(FOC36355) INVALID TYPE OF ARGUMENT #2 FOR USER FUNCTION CHKFMT



Cutting to the chase:
SALES is a numeric field. CHKFMT requires a character field as arg #2 (isn't that obvious?). Hence the FOC36355 message.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] FOCUS command to determine if value is N or A

Copyright © 1996-2020 Information Builders