Focal Point
[CLOSED] every 3 token i want to display the data from starting of string to 3 token

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

September 18, 2019, 04:39 AM
Developer
[CLOSED] every 3 token i want to display the data from starting of string to 3 token
Hi

i have a scenario like, on every 3 token(space) i want to display the data from starting first position of a string to still 3 token(space) of string.
when I use GETTOK , it will extract the data from 2 token to 3 token(space) data ,

extract each token and contacting the data i can do ,(my scenario i have to 20 token )


any idea apart from contacting the data

Input Data
APPLIED METHODS IN MKTG RESEARCH
APPLIED PRODUCT/MARKET MANAGEMENT
BUSINESS TO BUSINESS MKTG STRATEGY
CHANGING ROLE OF EX SEC & ADM ASST
CORPORATE FINANCIAL MANAGEMENT


my expected output should be below
Output Data
APPLIED METHODS IN
APPLIED PRODUCT/MARKET MANAGEMENT
BUSINESS TO BUSINESS
CHANGING ROLE OF
CORPORATE FINANCIAL MANAGEMENT





DEFINE FILE COURSE
CTITLE1/A100V = GETTOK(CTITLE, 30, 3,' ', 100, CTITLE1);
CTITLE2/A100V = IF CTITLE1 EQ '' THEN CTITLE ELSE CTITLE1;

END

TABLE FILE COURSE
PRINT DST.CTITLE CTITLE2
END


i appreciate your help in advance

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8202
September 18, 2019, 07:31 AM
MartinY
Note : always use the code tag when posting sample data and code
It's the last icon on the ribbon that looks like the below
</>


Don't know if I'm the only one, but your request is not clear for me.

Even based on your sample data (except for the second line, that since you only have 2 token in that row where you are looking for the third one in your DEFINE) the Output data seems to be good as per your sample code

How different, than your sample data, you want to contract the data ?

You should better give a complete sample of input data and desired output data


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
September 18, 2019, 10:15 AM
David Briars
Sounds like your requirement is to pull the first three tokens from a space delimited string, and then display them together within a report.

DEFINE FILE COURSE
 TOKEN1/A35 = TOKEN(COURSE, ' ', 1);
 TOKEN2/A35 = TOKEN(COURSE, ' ', 2);
 TOKEN3/A35 = TOKEN(COURSE, ' ', 3);
 NEW_COURSE/A105 = TOKEN1 | TOKEN2 | TOKEN3;
END
-*
TABLE FILE COURSE
PRINT COURSE AS 'COURSE' 
      NEW_COURSE
IF RECORDLIMIT EQ 5
END  

COURSE                             NEW_COURSE 
------                             ----------
HOW TO WRITE USERS MANUAL          HOW TO WRITE 
BUSINESS TO BUSINESS MKTG STRATEGY BUSINESS TO BUSINESS 
INTERVIEWING: A STRATEGIC APPROACH INTERVIEWING: A STRATEGIC 
EXECUTIVE COMMUNICATION            EXECUTIVE COMMUNICATION 
NEGOT AND ADMIN THE LABOR CONTRACT NEGOT AND ADMIN   

This message has been edited. Last edited by: David Briars,




Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
September 18, 2019, 02:27 PM
pav
Sounds like this link can be useful.

http://forums.informationbuild...1057331/m/7297005086