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.
I have looked at the discussions on the forums and I think I understand a bit more but I am still a bit confused. I am trying to put this SQL statement from our old reporting system into WebFOCUS and I realize there is no CASE on WF and I have to use the Define statement but I am unsure how you do multiple ones. The query looks like this:
SELECT COURSE_GROUP, SCHOOLNUM SUM(CASE WHEN MARK = 'A' THEN 1 ELSE 0 END) AS TOT_A, SUM(CASE WHEN MARK = 'B' THEN 1 ELSE 0 END) AS TOT_B, SUM(CASE WHEN MARK = 'C' THEN 1 ELSE 0 END) AS TOT_C, SUM(CASE WHEN MARK = 'D' THEN 1 ELSE 0 END) AS TOT_D, SUM(CASE WHEN MARK = 'F' THEN 1 ELSE 0 END) AS TOT_F) AS TOTAL_FAIL FROM SSASIDB1.ACHS_COURSE_HIST WHERE COURSE_GROUP = '2270' AND SCHLYEAR = '2007' GROUP BY COURSE_GROUP, SCHOOLNUM
Do I have to go into the text and code the compound IF statement? Being new we have done little coding in the body of the text instead. Thanks for the help.
I am going to keep the results in an hold table. There I will sum up TOT_A + TOT_B + TOT_C + TOT_D = TOT_PASS and write out to another hold file. Once all the groups are done (8), they will be read into the final report and percentages calculated for pass and fail for each group. But the hardest part is trying to figure out how to transfer the CASE into IF THEN ELSE.
7.6.5, Windows 2003, PDF, email, extract files
Posts: 10 | Location: Las Vegas NV | Registered: June 16, 2008
If you actually looked at a manual, this task would be as simple as it gets:
DEFINE FILE WHATEVER
TOT_A/I9 = IF MARK EQ 'A' THEN 1 ELSE 0;
TOT_B/I9 = IF MARK EQ 'B' THEN 1 ELSE 0;
TOT_C/I9 = IF MARK EQ 'C' THEN 1 ELSE 0;
TOT_D/I9 = IF MARK EQ 'D' THEN 1 ELSE 0;
TOT_F/I9 = IF MARK EQ 'F' THEN 1 ELSE 0;
END
TABLE FILE WHATEVER
SUM
TOT_A
TOT_B
TOT_C
TOT_D
TOT_F
COMPUTE TOT_PASS/I9 = TOT_A + TOT_B + TOT_C + TOT_D;
BY COURSE_GROUP
BY SCHOOLNUM
WHERE SCHLYEAR EQ '2007';
ON TABLE HOLD AS GOT_EM_ALL
END
-RUN
TABLE FILE GOT_EM_ALL
PRINT *
END
-EXIT
Try the above, check out the output, do some business analysis and see if you can't figure the rest out on your own...
You might also look into using SQL passthru option. Don't forget all of your selection criteria if you use Tom's example. Defines occur on each record selected.
Leah
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004
You can use Toms idea, but instead of using Defines, you use Computes. Sum Compute TOT_A/I9 = IF MARK EQ 'A' THEN 1 ELSE 0; Compute TOT_B/I9 = IF MARK EQ 'B' THEN 1 ELSE 0; Compute TOT_C/I9 = IF MARK EQ 'C' THEN 1 ELSE 0; Compute TOT_D/I9 = IF MARK EQ 'D' THEN 1 ELSE 0; Compute TOT_F/I9 = IF MARK EQ 'F' THEN 1 ELSE 0; COMPUTE TOT_PASS/I9 = TOT_A + TOT_B + TOT_C + TOT_D; etc.
WF 7.6.11 Oracle WebSphere Windows NT-5.2 x86 32bit
Bear in mind that all the fields in the formula for a Compute are taken from the summary values ("internal matrix"). So when you code the Computes,as sketched by RSquared, the references to MARK will all be to a single value.
(Under the covers, TABLE will insert MARK [in effect LST.MARK] NOPRINT as a hidden verb object, and the Computes will refer to its "summed" value).
Since that value can match at most one of the listed letters, at most one of the TOT_x Compute values will be 1 and the rest 0; and TOT_PASS will thus evaluate to 1 (or perhaps 0), not the sum of counts for all the letter values.
Stick with DEFINE.This message has been edited. Last edited by: j.gross,
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
What manuals do you suggest I download? We have taken 351 and 354 but obviously those classes only taught the surface. Now I need to get under the covers, so to speak. Do most of you code behind the scenes or with the GUI?
7.6.5, Windows 2003, PDF, email, extract files
Posts: 10 | Location: Las Vegas NV | Registered: June 16, 2008
If you want to look at coding, check out the wf761crlang.pdf (Creating Reports with the WebFOCUS Language) and wf761func.pdf (Using Functions) and wf761appslang (Developing Reporting Applications).
Also, in Developer Studio, there is a Help link on the top banner.
Mr. Jack Gross,
Thank you! couldn't have said it better myself... COMPUTE is for ROW manipulation(flags, totals, percentages, etc.) AFTER extract based on the BY columns.
When interviewing, asking the difference between DEFINE and COMPUTE is very telling...
What are you talking about "When interviewing, asking the difference between DEFINE and COMPUTE is very telling"? This has nothing to do with the question posed by vegaskitkat, who stated right at the beginning that this was a newbie question - you can't interview a newbie and expect them to know the difference between DEFINE and COMPUTE.
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
SELECT COURSE_GROUP, SCHOOLNUM SUM(CASE WHEN MARK = 'A' THEN 1 ELSE 0 END) AS TOT_A, SUM(CASE WHEN MARK = 'B' THEN 1 ELSE 0 END) AS TOT_B, SUM(CASE WHEN MARK = 'C' THEN 1 ELSE 0 END) AS TOT_C, SUM(CASE WHEN MARK = 'D' THEN 1 ELSE 0 END) AS TOT_D, SUM(CASE WHEN MARK = 'F' THEN 1 ELSE 0 END) AS TOT_F) AS TOTAL_FAIL FROM SSASIDB1.ACHS_COURSE_HIST WHERE COURSE_GROUP = '2270' AND SCHLYEAR = '2007' GROUP BY COURSE_GROUP, SCHOOLNUM
I would do this
TABLE FILE SSASIDB1.ACHS_COURSE_HIST
SUM CNT.MARK
BY COURSE_GROUP
BY SCHOOLNUM
ACROSS MARK
ON COURSE_GROUP SUBHEAD
"<COURSE_GROUP"
ON COURSE_GROUP SUBTOTAL
ON TABLE ROW-TOTAL
END
I don't know how to calculate percentage pass or fail (I live in Europe and we have an other system) but I'm rather sure that the calculation can be done in the same process.
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, 2006