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] Substring parameter into multiple parameters

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Substring parameter into multiple parameters
 Login/Join
 
Platinum Member
posted
Hi,

Does anyone no how to split one parameter into multiple parameters.

Excample :

Input : &WEEKNUMBERS = 01 OR 06 OR 10 OR 11
Output: &WEEKNUMBER01 = 01
&WEEKNUMBER02 = 06
&WEEKNUMBER03 = 10
&WEEKNUMBER04 = 11

Thanks Mark

This message has been edited. Last edited by: FP Mod Chuck,
 
Posts: 103 | Registered: March 18, 2008Report This Post
Platinum Member
posted Hide Post
Hi

You can use the GETTOK function.

Example
-* 2017-10-18 - Split var based +1 char delimiter.

-DEFAULTH &STR = '01 OR 06 OR 10 OR 11' ;
-DEFAULTH &DEL = ' OR ' ;

-TYPE String...: '&STR'
-TYPE Delimiter: '&DEL'

-* Use 1 char delimiter, comma for example.
-SET &LEN = &STR.LENGTH ;
-SET &STR = STRREP (&LEN, &STR, &DEL.LENGTH, &DEL, 1, ',', &LEN, 'A&LEN.EVAL') ;
-SET &STR = TRUNCATE(&STR);
-SET &LEN = &STR.LENGTH ;

-* Tokens extraction loop.
-SET &I = 0 ;
-SET &SUB = 'X' ;
-REPEAT :LOOPEND WHILE &SUB NE ' ' ;
-SET &I = &I + 1 ;
-SET &SUB = GETTOK(&STR, &LEN, &I, ',', &LEN, 'A&LEN');
-SET &SUB = TRUNCATE(&SUB) ;
-SET &SUB.&I = &SUB ;
-TYPE Substr &I : &SUB.&I
-:LOOPEND


Output
String...: '01 OR 06 OR 10 OR 11'
Del......: ' OR '
Substr 1 : 01
Substr 2 : 06
Substr 3 : 10
Substr 4 : 11
Substr 5 :


Regards. Mikel.


WebFOCUS 8.1.05, 8.2.01
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
Platinum Member
posted Hide Post
Hi Mikel,

Thanks exactly what I needed.

Kind Regards

Mark
 
Posts: 103 | Registered: March 18, 2008Report This Post
Virtuoso
posted Hide Post
Using WF8 you can also use TOKEN function. It's a little more simplest then GETTOK but do the same.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Expert
posted Hide Post
I like the new TOKEN function better than GETTOK Smiler
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Platinum Member
posted Hide Post
Doug,

I was working with Token function in WF 8105
and I replaced GETTOK function with TOKEN in Mikel's code it shows error
quote:
(FOC36355) INVALID TYPE OF ARGUMENT #3 FOR USER FUNCTION TOKEN


 
 -DEFAULTH &STR = '01 OR 06 OR 10 OR 11' ;
-DEFAULTH &DEL = ' OR ' ;

-TYPE String...: '&STR'
-TYPE Delimiter: '&DEL'

-* Use 1 char delimiter, comma for example.
-SET &LEN = &STR.LENGTH ;
-SET &STR = STRREP (&LEN, &STR, &DEL.LENGTH, &DEL, 1, ',', &LEN, 'A&LEN.EVAL') ;
-SET &STR = TRUNCATE(&STR);
-SET &LEN = &STR.LENGTH ;

-* Tokens extraction loop.
-SET &I = 0 ;
-SET &SUB = 'X' ;
-REPEAT :LOOPEND WHILE &SUB NE ' ' ;
-SET &I = &I + 1 ;
-*-SET &SUB = GETTOK(&STR, &LEN, &I, ',', &LEN, 'A&LEN');
-SET &SUB = TOKEN(&STR, ',' ,&I );
-SET &SUB = TRUNCATE(&SUB) ;
-SET &SUB.&I = &SUB ;
-TYPE Substr &I : &SUB.&I
-:LOOPEND


It seems that we can not pass Parameter value in number place.

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


WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) ,
8.2.0.1M , 8.2.0.2 (App-Studio8.2.x),
InfoAssist/+, InfoDiscovery
Output format:-AHTML, PDF, Excel, HTML
Platform:-Windows 7, 8,10
 
Posts: 186 | Location: Infobuild India | Registered: August 28, 2015Report This Post
Virtuoso
posted Hide Post
I just tried your code in 8.2.01M and it worked. Which version did you test in?


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Virtuoso
posted Hide Post
Perform this small change as for WF8105 to work :

-SET &SUB = TOKEN(&STR, ',' ,&I.EVAL);


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Platinum Member
posted Hide Post
quote:
I just tried your code in 8.2.01M and it worked. Which version did you test in?

BabakNYC I was trying it in WF8105M


WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) ,
8.2.0.1M , 8.2.0.2 (App-Studio8.2.x),
InfoAssist/+, InfoDiscovery
Output format:-AHTML, PDF, Excel, HTML
Platform:-Windows 7, 8,10
 
Posts: 186 | Location: Infobuild India | Registered: August 28, 2015Report This Post
Platinum Member
posted Hide Post
quote:
Perform this small change as for WF8105 to work :

-SET &SUB = TOKEN(&STR, ',' ,&I.EVAL);



Thanks Martin in WF8105 it works with "EVAL"


WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) ,
8.2.0.1M , 8.2.0.2 (App-Studio8.2.x),
InfoAssist/+, InfoDiscovery
Output format:-AHTML, PDF, Excel, HTML
Platform:-Windows 7, 8,10
 
Posts: 186 | Location: Infobuild India | Registered: August 28, 2015Report 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] Substring parameter into multiple parameters

Copyright © 1996-2020 Information Builders