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     AK's question: How to transpose Row containing multiple values to multiple rows

Read-Only Read-Only Topic
Go
Search
Notify
Tools
AK's question: How to transpose Row containing multiple values to multiple rows
 Login/Join
 
Virtuoso
posted
AK,
This is a perfect example for the use of the McGuyver technique. Please see the following files:

AK master:
  
FILE=AK, SUFFIX=FIX
 SEGNAME=SEG1, SEGTYPE=S0
 FIELD=DEPT, ALIAS=DP, USAGE=I3, ACTUAL=A3, $
 FIELD=CITIES, ALIAS=CTS, USAGE=A50, ACTUAL=A50, $


AK data:
  
001Chicago,Lisle,Naperville
002Detroit,Southfield,Kalamazoo
003New York,Albany
004Washington
005San Francisco,Los Angeles,San Diego,Beverly Hills


Now the McGuyver file (with heartfelt thanks to Noreen!). Master:
  
FILENAME=FSEQ,SUFFIX=FIX
  SEGNAME=CHAR1,SEGTYPE=S0
   FIELDNAME=BLANK,BLANK,A1,A1,$
SEGNAME=CHARS,SEGTYPE=S0,PARENT=CHAR1,OCCURS=VARIABLE
   FIELDNAME=CHAR,CHARS,A1,A1,$
   FIELDNAME=COUNTER,ORDER,I2,I4,$


And the McGuyver data file (!! Very important-the data must start with a blank !!):
  
 FILEFORMCGUYVERFILEFORMCGUYVERFILEFORMCGUYVERFILEFORMCGUYVERFILEFORMCGUYVER


And finally the focexec to solve your problem, taking into account that one knows the maximum number of cities in the CITIES field:
  
-* File AK1.fex
-SET &ECHO=ALL;
-SET &MAXCITY=4;
-*
-* Location of data files (AK doesn't need the AK since the data comes from an SQL table)
FILEDEF AK DISK C:\ibi\apps\focalpoint\AK.ftm
FILEDEF FSEQ DISK C:\ibi\apps\focalpoint\fseq.dat
-RUN
-*
-* This Join allows the multiplication of AK records in order to extract subsequent cities
JOIN BLANK WITH DEPT IN AK 
  TO BLANK IN FSEQ AS M_
END
-*
-* BLANK for joining to McGuyver
-* one CITY is extracted from the string for every value of COUNTER
DEFINE FILE AK
BLANK/A1 WITH DEPT=' ';
CITY/A25=GETTOK(CITIES, 50, COUNTER, ',', 25, 'A25');
END
-*
-* Limit the number of occurence to &MAXCITY and to non-blank values of CITY
TABLE FILE AK
PRINT CITY
BY DEPT
IF COUNTER LE &MAXCITY
IF CITY NE ' '
END

See if it works.


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
Thanks a lot Daniel for sharing the suggestion with all. Smiler

FYI, here is the topic that Daniel is referring to: https://forums.informationbuilders.com/eve/forums/a/tpc/...1057331/m/6921034682

Cheers, Smiler

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
 
Posts: 1948 | Location: New York | Registered: November 16, 2004Report 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     AK's question: How to transpose Row containing multiple values to multiple rows

Copyright © 1996-2020 Information Builders