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] Converting db rows into columns

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Converting db rows into columns
 Login/Join
 
Gold member
posted
HI,

I have a requirement in my report where in i need to convert each of row from the db into a report column.

Example:

DB rows
--------
ID ID_value ID_TYPE
-------------------------------------
AAA 2h24h3j4 2440
AAA 35785jhrj 2441
AAA fjg897t89 2442
AAA kljgklj88 2443


So i need to identify for the same id for each of the different category id_type i have to have a separate column
like below:

ID column1 column2 column3 column4
------------------------------------------------
AAA 2h24h3j4 35785jhrj fjg897t89 kljgklj88

I need not display the ID_value,ID_TYPE and also ID.

Hence for a previous report , i had requirement wherein i need to convert only two rows as two columns.Hence
i used the hold file concept , where in i created two separate hold file with FORMAT FOCUS INDEX syntax and joined
both the hold files. But in this case i need to do this for atleast 12 to 14 rows. Is there any other way to do it ?

I had tried the below(EXAMPLE FOR TWO ROWS ALONE) :

  
TABLE FILE SQLOUT
PRINT
*
ON TABLE HOLD AS HLD_NCP
END


DEFINE FILE HLD_NCP
ID
State_License/A50= IF ID_TYPE_C EQ 2454 THEN PHARM_DEF_LOC_ID_I ELSE ' ';
NPI/A50 = IF ID_TYPE_C EQ 2451 THEN PHARM_DEF_LOC_ID_I ELSE '  ';
END

TABLE FILE HLD_NCP
SUM
PHARM_DEF_LOC_I
State_License
NPI
BY PHARM_DEF_LOC_I NOPRINT
END



Output is as follows:
-------------------------------------
PAGE 1

PHARM_DEF_LOC_I State_License NPI
AAA

Here Statelicense and NPI are blank.

When you change the SUM to PRINT , output is as follows:

PAGE 1

PHARM_DEF_LOC_I State_License NPI
AAA
AAA 28RS00562100
AAA 1396767901
AAA
AAA
AAA
AAA

I get only the last record. Ss this because the unique identifier is alphanumeric that i get only the
last record retrieved?

Whereas i need the following output:

PAGE1
------
PHARM_DEF_LOC_I State_License NPI
AAA 28RS00562100 1396767901

Appreciate your help

Thanks!
Jan

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


WebFOCUS 7.6.9
Windows
Excel, HTML, PDF
 
Posts: 71 | Registered: April 17, 2009Report This Post
Expert
posted Hide Post
Jan, have you looked into using the ACROSS phrase?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Virtuoso
posted Hide Post
Jan,

Ginny has the right approach. Just beware that ACROSS is limited to 64 values.
Now, when you sort ACROSS, you want to number the occurences for each ID. WF provides a nice feature: LIST.
  
TABLE FILE CAR
LIST SALES SEATS
BY COUNTRY
ON TABLE HOLD
END
-RUN
DEFINE FILE HOLD
ALIST/A5=LJUST(5, FTOA(LIST, '(D5c)', 'A5'), 'A5');
COLS/A12='COLUMN' || ALIST;
END
TABLE FILE HOLD
SUM SALES SEATS
BY COUNTRY
ACROSS COLS AS ''
ON TABLE SET HTMLCSS ON
END


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
Virtuoso
posted Hide Post
Jan, Danny,

The limit for ACROSS columns and values have been greatly increased. In 711 it was a maximum of 1024, later releases should support a total of 1056. This is all limited further by the maximum record length overall, which is 32 Kb.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Gold member
posted Hide Post
Hi,

Using ACROSS i was able to resolve the issue,like below:

 
DEFINE FILE PHMSTR
State_License/I2= IF PHARM_DEF_LOC_I EQ LAST PHARM_DEF_LOC_I THEN State_License + 1 ELSE 1 ;
END

TABLE FILE PHMSTR
SUM
PHARM_DEF_LOC_ID_I
ACROSS State_License AS ''
BY Store
 


Thanks!
janani


WebFOCUS 7.6.9
Windows
Excel, HTML, PDF
 
Posts: 71 | Registered: April 17, 2009Report 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] Converting db rows into columns

Copyright © 1996-2020 Information Builders