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] Transforming Columns into Rows

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Transforming Columns into Rows
 Login/Join
 
Member
posted
Hello Everyone,

What is the best method of converting 1 row by 30 column hold file table to a 30 row by 2 column hold file table? I will need to perform additional computations on the table after the conversion.

Thanks!

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8008
Windows, All Outputs
 
Posts: 14 | Registered: April 10, 2014Report This Post
Expert
posted Hide Post
Whats the format of the 30 columns, are they all the same ?


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
Hi John,

You might be able to use a master that uses OCCURS

.... or ....

I gave a 30 minute lunchtime demo on a technique that may fit this requirement.

Consider this code and how it repeats the two columns that I want, and places a carriage return to separate each "line" of output. You could use a line feed char instead Using an alternative master gives me the columnar output.
EX -LINES 12 EDAPUT MASTER,TEMPDATA,CV,MEM
FILENAME=TEMPDATA, SUFFIX=FIX, $
SEGMENT=SEG01, SEGTYPE=S0, $
FIELD=KEYCOL, USAGE=A15, ACTUAL=A15, $
FIELD=DATA01, USAGE=A10, ACTUAL=A10, $
FIELD=DATA02, USAGE=A10, ACTUAL=A10, $
FIELD=DATA03, USAGE=A10, ACTUAL=A10, $
FIELD=DATA04, USAGE=A10, ACTUAL=A10, $
FIELD=DATA05, USAGE=A10, ACTUAL=A10, $
FIELD=DATA06, USAGE=A10, ACTUAL=A10, $
FIELD=DATA07, USAGE=A10, ACTUAL=A10, $
FIELD=DATA08, USAGE=A10, ACTUAL=A10, $
FILEDEF TEMPDATA DISK TEMPDATA.TXT
-RUN
-WRITE TEMPDATA Key Value      data 01   data 02   data 03   data 04   data 05   data 06   data 07   data 08   
-RUN

TABLE FILE TEMPDATA
PRINT
-REPEAT :Loop FOR &Cntr FROM 1 TO 8;
   KEYCOL DATA0&Cntr.EVAL
   COMPUTE CR/A1 = HEXBYT(13, 'A1');
-:Loop
ON TABLE HOLD AS HOLDDATA FORMAT ALPHA
END
-RUN

CMD TYPE HOLDDATA.FTM

EX -LINES 6 EDAPUT MASTER,HOLDDATA,CV,MEM
FILENAME=HOLDDATA, SUFFIX=FIX, $
SEGMENT=SEG01, SEGTYPE=S0, $
FIELD=KEYCOL, USAGE=A15, ACTUAL=A15, $
FIELD=DATAVAL, USAGE=A10, ACTUAL=A10, $
FIELD=CR, USAGE=A1, ACTUAL=A1, $

TABLE FILE HOLDDATA
PRINT DATAVAL
   BY KEYCOL
ON TABLE SET PAGE NOLEAD
END
-RUN

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
Member
posted Hide Post
Waz,

All columns are the same format. My specific format is P13.2CM. For future reference, is there a type of format that would cause problems?

Thanks,
John


WebFOCUS 8008
Windows, All Outputs
 
Posts: 14 | Registered: April 10, 2014Report This Post
Virtuoso
posted Hide Post
There is no best method, it all depends on circumstance and preference.

One of my favourite for this is to use OVER and FORMAT WP:
APP HOLD BASEAPP
TABLE FILE CAR
PRINT COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
OVER COUNTRY AS ''  RCOST/D7c  AS '' DCOST/D7c AS ''
BY COUNTRY NOPRINT
ON TABLE HOLD AS MLINE FORMAT WP
ON TABLE SET PAGE NOLEAD
ON TABLE SET LINES 998
END

and then create an mfd over the output.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
I prefer the "OCCURS" method:
FILENAME=TEMPDATA, SUFFIX=FIX, $
SEGMENT=SEG01, SEGTYPE=S0, $
FIELD=KEYCOL, USAGE=A15, ACTUAL=A15, $
SEGMENT=SEG02, PARENT=SEG01, OCCURS=VARIABLE
FIELD=DATA01, USAGE=A10, ACTUAL=A10, $


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
There are many ways to do this.

How you do it will rely on that you are doing with the results.


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
Member
posted Hide Post
In this instance we will be doing further calculations on the data once its transformed.

Thank you all for your suggestions.

John


WebFOCUS 8008
Windows, All Outputs
 
Posts: 14 | Registered: April 10, 2014Report 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] Transforming Columns into Rows

Copyright © 1996-2020 Information Builders