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] Newbie Question - Turn Records into Fields

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Newbie Question - Turn Records into Fields
 Login/Join
 
Member
posted
Trying to write a query that pulls a student's previous transfer colleges. I need the college name, beginning date, and ending date. The user wants a field for College 1, College 2, etc. The dates have to be in their own fields, too.

  
The database:

STUDENT ID   SEQUENCE   COLLEGE      BEGIN DATE   END DATE
1234         1          1st College  201301       0
             2          2nd College  200208       200305


What user wants:

STUDENT ID   COLLEGE 1     BEGIN    END   COLLEGE 2    BEGIN   END
1234         1st College   201301   0     2nd College  200208  200305




I solved the problem of assigning the college names to their own fields with this:

DEFINE FILE COLHIST1
	COL1/A32 = IF (SEQUENCE EQ 1) THEN COLLEGE_NAME;
	COL2/A32 = IF (SEQUENCE EQ 2) THEN COLLEGE_NAME;
	COL3/A32 = IF (SEQUENCE EQ 3) THEN COLLEGE_NAME;
END
  


But when I tried the same thing with the dates, all of them are completely off.

DEFINE FILE COLHIST1
	BEG_DT1/I9 = IF (SEQUENCE EQ 1) THEN BEGIN_DT;
	BEG_DT2/I9 = IF (SEQUENCE EQ 2) THEN BEGIN_DT;
	BEG_DT3/I9 = IF (SEQUENCE EQ 3) THEN BEGIN_DT;
	END_DT1/I9 = IF (SEQUENCE EQ 1) THEN END_DT;
	END_DT2/I9 = IF (SEQUENCE EQ 2) THEN END_DT;
	END_DT3/I9 = IF (SEQUENCE EQ 3) THEN END_DT;
END
  


I am wondering whether it has something to do with the date being a 9-character integer, because obviously what the database is showing is not 9 characters. And on the user's display screen, it shows up MM-YYYY. I have double-checked and I am grabbing the right field.

Any suggestions would be appreciated.

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


Dev. Studio 7.6.11
Win 7
 
Posts: 21 | Location: Oklahoma | Registered: November 01, 2012Report This Post
Silver Member
posted Hide Post
Could you check the data type of BEGIN_DT and END_DT?

One way of checking is using:
-SET &ECHO=ALL;
... program ...
?FF COLHIST1
-EXIT


Then assign the same data type to BEG_DTx/END_DTx.


Year(s) of experience in WebFOCUS: 5+. Using WebFOCUS 7.7.03 on Windows platform with Oracle/SQL Server.
 
Posts: 41 | Registered: September 08, 2008Report This Post
Expert
posted Hide Post
How about using ACROSS, you shouldn't have to worry about column formats:

TABLE FILE COLHIST1
SUM
COLLEGE
BEGIN DATE
END DATE
BY STUDENT_ID
ACROSS SEQUENCE AS ''
END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
Thank you JL and Francis. Francis, I am not sure an ACROSS would work since this is just a very small part of a much larger program. The final report will have over 150 columns. (Yeah, they asked the new guy with no experience to do it. Confused )

JL, that is a seriously awesome bit of code! That will help so much in the future. Thank you for that new tool!

Anyway, this is what the report says that the beginning and ending dates actually are

  
 BEGIN_DT                E05                     I11
 END_DT                  E06                     I11


Another programmer just stepped into my office and said something about the dates have to be DECODED and something about "packed" and pointed to our FOCUS manual. So, I guess I have some reading to do.


Dev. Studio 7.6.11
Win 7
 
Posts: 21 | Location: Oklahoma | Registered: November 01, 2012Report This Post
Expert
posted Hide Post
Since the fields are defined as I11, they're not "packed" and they don't need to be DECODED. Just use the same format in your DEFINE.

I'm not sure why ACROSS would not work here. If you create a HOLD file using ACROSS, you will end up with field names similar to the ones in your DEFINE, the SEQUENCE field makes the names different:

SET ASNAMES=ON
SET HOLDLIST=PRINTONLY
TABLE FILE COLHIST1
SUM
COLLEGE
BEGIN DATE
END DATE
BY STUDENT_ID
ACROSS SEQUENCE
ON TABLE HOLD AS H001
END
-RUN

?FF H001
-RUN

The generated names will be abbreviated and perhaps not to your liking, but that shouldn't matter - it avoids having to define virtual fields for every SEQUENCE.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Perhaps "ACROSS SEQUENCE NOPRINT" in conjuction with LAST or MIN, or MAX (BEGIN or END DATEs) may be useful...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
Sam,
I assume that for each student you have a sequence from 1 to whatever. Since you say that there is more than meets the eye (btw, who would want a report with 150 columns??? crazy!!!), I would suggest using some dialog manager to create fields for each college.

  
TABLE FILE COLHIST1
SUM MAX.SEQUENCE
ON TABLE SAVE
END
-RUN
-READ SAVE,&MAXSEQ
-RUN
DEFINE FILE COLHIST1
-REPEAT #FIELDS FOR &I FROM 1 TO &MAXSEQ;
COLLEGE&I / A32 = IF SEQUENCE EQ &I THEN COLLEGE_NAME ELSE ' ';
BDATE&I / I6 = IF SEQUENCE EQ &I THEN BEGIN_DATE ELSE 0;
EDATE&I / I6 = IF SEQUENCE EQ &I THEN END_DATE ELSE 0;
-#FIELDS
END

TABLE FILE COLHIST1
SUM 
-REPEAT #PRINT FOR &I FROM 1 TO &MAXSEQ;
MAX.COLLEGE&I MAX.BDATE&I MAX.EDATE&I
-#PRINT
BY STUDENT_ID
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
Member
posted Hide Post
Thank you everyone for the suggestions. I just learned, however, that the data entry clerks use neither rhyme nor reason when entering the sequences. So, that puts the breaks on my efforts.

I do think these suggestions are fantastic. I want to try every one when I get back to that point. Again, thank you.


Dev. Studio 7.6.11
Win 7
 
Posts: 21 | Location: Oklahoma | Registered: November 01, 2012Report This Post
Master
posted Hide Post
Why complicate matters?
TABLE FILE COLHIST1
PRINT
BEGIN DATE
END DATE
BY STUDENT_ID
ACROSS COLLEGE
END


You can have as many columns as you like per college...


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report This Post
Virtuoso
posted Hide Post
Print and across?

I would say sum and across might work, but with a print you get not the report you like




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Member
posted Hide Post
Using an ACROSS gave me an error of "Max of 255 across instances in online report exceeded." But I think I have it figured out now. The real problem turned out to be that the SEQUENCE numbers were entered by the data entry clerks without rhyme or reason. So, I had to define my own. Once I did, a simple JOIN caused everything fall into place.

I appreciate everybody's help.


Dev. Studio 7.6.11
Win 7
 
Posts: 21 | Location: Oklahoma | Registered: November 01, 2012Report This Post
Master
posted Hide Post
Oops ... You're right Frank. Should be SUM. And I echo someone else's remark - Who wants a report with more than 200 columns ??? I know that wide screens are available now, but still ...


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report This Post
Virtuoso
posted Hide Post
George,
One hears so many.
When a customer asks me in WebFOCUS can retrieve 10,000 records, I ask, with incredulity, who might want to leaf through 10,000 lines of a report? The whole idea of BI is to allow the user to zoom in to what is desired.
Oh well...


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
I do agree to Danny on this matter.
BI is business intelligente. Convert data to Information.
Many users ask for data in a spreadsheet but in the end they are going to make a pivot report on the data we deliver.
When they take the time to look at the deeper possibilities we can offer, some make the next step.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report 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] Newbie Question - Turn Records into Fields

Copyright © 1996-2020 Information Builders