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     [SOLVED] Converting Alpha to Numeric?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Converting Alpha to Numeric?
 Login/Join
 
Master
posted
When using the following code,
-DEFAULT &VAR_YEARMONTH = 200810;
-SET &CYEAR = SUBSTR(6, &VAR_YEARMONTH, 1, 4, 4, A4);
-SET &P1YEAR = EDIT(SUBSTR(6, &VAR_YEARMONTH, 1, 4, 4, A4)) -1;

I get the error

0 ERROR AT OR NEAR LINE 5 IN PROCEDURE mrheaderFOCEXEC *
(FOC281) ALPHA ARGUMENTS IN PLACE WHERE NUMERIC ARE CALLED FOR

The error only comes up when I try to do a "-1" on the third line.
I'm sure it's obvious, but I don't see it.

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


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 611 | Registered: January 04, 2007Report This Post
Virtuoso
posted Hide Post
Here are a few tips:

&variables are not specifically numeric- they are always just a string. If the value is a valid number then it it can be used in a numeric operation without any conversion. So you could just pull out what you need with an edit and subtract 1.

-DEFAULT &YRMTH
-SET &CYEAR=EDIT(&YRMTH,'9999');
-SET &P1YEAR=&CYEAR.EVAL - 1;

Also, the guidelines say that &var names should not be more than 12 characters.

This message has been edited. Last edited by: Darin Lee,


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
-SET &ECHO=ALL;
-DEFAULT &VAR_YEARMONTH = 200810;
-SET &CYEAR = SUBSTR(6, &VAR_YEARMONTH, 1, 4, 4, A4);
-TYPE &CYEAR
-SET &P1YEAR=&CYEAR-1;
-TYPE &P1YEAR
-*-SET &P1YEAR = EDIT(SUBSTR(6, &VAR_YEARMONTH, 1, 4, 4, A4)) -1; 

You are mixing an alphanumeric subroutine with arithmetic. You don't need that last line. You can also use EDIT instead of SUBSTR to extract the year (fewer parms).

Oops, didn't post the correct code earlier.

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


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
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Master
posted Hide Post
Thanks, this works!


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 611 | Registered: January 04, 2007Report 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     [SOLVED] Converting Alpha to Numeric?

Copyright © 1996-2020 Information Builders