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] GETTOK in Dialiogue Manager

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] GETTOK in Dialiogue Manager
 Login/Join
 
Platinum Member
posted
I'm having trouble with the first of these 2 GETTOK's.

I need to extract the month and year from &DATE_FOR_REPORT. &DATE_FOR_REPORT receives its value in the format of MMYYYY where MM can be 1 or 2 digits (it may or may not have a leading zero).

The GETTOK for &YEAR results in the agent crashing. The second GETTOK works fine. Any suggestions on what's causing the problem and how to fix it?

  
-SET &YEAR         = GETTOK (&DATE_FOR_REPORT.EVAL, 6, -1, '2', 4, &YEAR);
-SET &MONTH_NUMBER = GETTOK (&DATE_FOR_REPORT.EVAL, 6, -2, '2', 2, &MONTH_NUMBER);

-TYPE &YEAR
-TYPE &MONTH_NUMBER


Thank you,

John

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


WF 7.7.03, Windows 7, HTML, Excel, PDF
 
Posts: 225 | Location: San Francisco Bay Area, California | Registered: October 26, 2006Report This Post
Expert
posted Hide Post
John, I would suggest not using GETTOK, as there is no clear delimiter for the month and year.

The issue with GETTOK is that you are using the number 2 as a delimiter, this will give you problems with February and December.

My suggestion is using EDIT or SUBSTR. The length of the string will indicate whether there is a 1 or 2 digit month.

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


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
Why would you use GETTOK???
Use EDIT or SUBSTR...

  
-SET &DATE_FOR_REPORT = '12007';

-SET &YR1 = IF &DATE_FOR_REPORT.LENGTH EQ 6 THEN &DATE_FOR_REPORT ELSE '0' || &DATE_FOR_REPORT;

-SET &YEAR         = SUBSTR( 6, '&YR1.EVAL', 3, 6, 4, 'A4');
-SET &MONTH_NUMBER = SUBSTR( 6, '&YR1.EVAL', 1, 2, 2, 'A2');

-SET &YEAR1        = EDIT(&YR1.EVAL,'$$9999');
-SET &MO_NUMBER    = EDIT(&YR1.EVAL,'99');

-TYPE &YEAR
-TYPE &MONTH_NUMBER

-TYPE &YEAR1
-TYPE &MO_NUMBER

-EXIT


This works...

hth

EDIT: Waz beat me, old farts think alike!! Smiler

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
And, yet another way to skin this cat:
-* -SET the &DATE_FOR_REPORT to '12007' to see it work with 5 digits...
-SET &DATE_FOR_REPORT = '012007';
-SET &YR2 = IF &DATE_FOR_REPORT.LENGTH EQ 6 THEN EDIT(&DATE_FOR_REPORT,'99')  ELSE '0' || EDIT(&DATE_FOR_REPORT,'9');
-SET &MN2 = IF &DATE_FOR_REPORT.LENGTH EQ 6 THEN EDIT(&DATE_FOR_REPORT,'$$9999')  ELSE EDIT(&DATE_FOR_REPORT,'$9999');
-TYPE &YR2 &MN2

Just some more food for thought... Ain't DM Gr8! Big Grin
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
quote:
The GETTOK for &YEAR results in the agent crashing. The second GETTOK works fine.

Just wondering - if the first one crashes, then the second one will never run ... (I suppose -* was used).

But the official syntax for dialog manager is not to have the field named as output parameter, but to specify the format. And that is probably the cause of your crash.
The suggestions to use substr are also valid, but your code should be ok when you change the format of the output field to be 'A4' and 'A2'.
Oh, you do not need the .EVAL's in this case. But you do need to give it the correct length.
-SET &YEAR         = GETTOK (&DATE_FOR_REPORT, &DATE_FOR_REPORT.LENGTH, -1, '2', 4, 'A4');
-SET &MONTH_NUMBER = GETTOK (&DATE_FOR_REPORT, &DATE_FOR_REPORT.LENGTH, -2, '2', 2, 'A2');

should do the trick.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Expert
posted Hide Post
So much effort for such a simple requirement -
-SET &MYDATE = '012007';
-SET &Year = DATECVT(&MYDATE, 'I6MYY', 'YY');
-SET &Mnth = DATECVT(&MYDATE, 'I6MYY', 'M');
-TYPE &Year &Mnth
or
-SET &MYDATE = '12007';
-SET &Year = DATECVT(&MYDATE, 'I6MYY', 'YY');
-SET &Mnth = DATECVT(&MYDATE, 'I6MYY', 'M');
-TYPE &Year &Mnth

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
I like, many ways to work! Is be simples!

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
 
Posts: 106 | Registered: April 06, 2009Report This Post
Expert
posted Hide Post
And I thought mine was simple... But, Tony, Yours Rocks. The DATECVT is, probably, the "best" solution in that it is as BASE FOCUS as I can see it - IMHO...




   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
  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] GETTOK in Dialiogue Manager

Copyright © 1996-2020 Information Builders