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.
TABLE FILE EMPDATA
SUM
SALARY
BY DEPT
ACROSS DIV
COMPUTE TESTDIFF/D12.2 = C2 - C1;
ON TABLE HOLD
END
TABLE FILE HOLD
PRINT
TESTDIFF
BY DEPT
WHERE TESTDIFF GT 0
END
Try this with and without the WHERE.
Regards,
John
WF 7.7.03, Windows 7, HTML, Excel, PDF
Posts: 225 | Location: San Francisco Bay Area, California | Registered: October 26, 2006
DEFINE FILE EMPDATA
SALINCR/D12.2=SALARY * 1.05;
END
TABLE FILE EMPDATA
SUM
SALINCR SALARY
COMPUTE TESTDIFF/D12.2 = C1 - C2;
BY DEPT
BY DIV
WHERE TOTAL TESTDIFF GE 5000
ON TABLE HOLD
END
TABLE FILE HOLD
SUM TESTDIFF
BY DEPT
ACROSS DIV
END
As you can see, the DIF field is not accessible in your TABLE request.
So, you have to create a HOLD file to be able to test the DIF field. Here is a possibility, using the CAR file.
SET ASNAMES=ON
TABLE FILE CAR
IF SEATS NE 5
SUM SALES AS 'SEATS='
BY COUNTRY
ACROSS SEATS COMPUTE DIF/I6=C1 - C2;
ON TABLE HOLD
END
JOIN COUNTRY IN HOLD TO COUNTRY IN CAR AS A_
TABLE FILE HOLD
IF DIF NE 0
IF SEATS NE 5
SUM SALES
BY COUNTRY
ACROSS SEATS COMPUTE DIF/I6=C1 - C2;
END
If you do not need to show the ACROSS field then this is also possible:
SET ASNAMES=ON
TABLE FILE CAR
IF SEATS NE 5
SUM SALES AS 'SEATS='
BY COUNTRY
ACROSS SEATS COMPUTE DIF/I6=C1 - C2;
ON TABLE HOLD
END
TABLE FILE HOLD
PRINT *
IF DIF NE 0
END
Good luck....
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, 2006
Originally posted by GinnyJakes: Cribbing from John's code, try this:
DEFINE FILE EMPDATA
SALINCR/D12.2=SALARY * 1.05;
END
TABLE FILE EMPDATA
SUM
SALINCR SALARY
COMPUTE TESTDIFF/D12.2 = C1 - C2;
BY DEPT
BY DIV
WHERE TOTAL TESTDIFF GE 5000
ON TABLE HOLD
END
TABLE FILE HOLD
SUM TESTDIFF
BY DEPT
ACROSS DIV
END
This seems to work fine. Thanks.
I'll also look at your suggestion Danny. Thanks as well!
OK. After making something work, I have this issue using the technique above, there's one big show stopper.
Basically my master file has a key with a year and 12 months of data. The user selects a month on the screen and the report will show him the 12 months along with the variance between the month selected and the previous one.
Using the technique above, this works fine. This is the way I coded it to make the filter of the variance work (user selected March):
TABLE FILE MYTABLE SUM JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
COMPUTE VARIANCE/I9 = C3 - C2;
BY FIELD1 BY YEAR
WHERE YEAR EQ '2008' OR '2009' WHERE TOTAL VARIANCE GE 100
ON TABLE HOLD END
TABLE FILE HOLD SUM JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
BY FIELD1 ACROSS YEAR COMPUTE VARIANCE/I9 = C3 - C2;
END
Works great. Except for one thing. If the user selects January, I'm screwed.
TABLE FILE TEMP1 SUM NOV DEC JAN FEB MAR APR MAY JUN JUL AUG SEP OCT BY FIELD1 ACROSS YEAR COMPUTE Variance/I9 = IF &NBRYEARS LE 1 THEN &COL1 ELSE &COL1 - &COL2; END