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.
Hy, I have a report which data source is the union of two queries with different date.
On this report I display some amounts. Now I need to show also the difference between them.
Something like this is what I have:
ACROSS FIELD TYPE 1 TYPE 2 TYPE 3 ... BY1 DATE1 AMOUNT1 AMOUNT2 AMOUNT3 ... DATE2 AMOUNT1 AMOUNT2 AMOUNT3 ... BY2 DATE1 AMOUNT1 AMOUNT2 AMOUNT3 ... DATE2 AMOUNT1 AMOUNT2 AMOUNT3 ... . . . . . ... . . . . . ... . . . . . ...
And I need something like this:
ACROSS FIELD TYPE 1 TYPE 2 TYPE 3 ... BY1 DATE1 AMOUNT1 AMOUNT2 AMOUNT3 ... DATE2 AMOUNT1 AMOUNT2 AMOUNT3 ... Difference: And here I'd display the difference of the two above values. BY2 DATE1 AMOUNT1 AMOUNT2 AMOUNT3 ... DATE2 AMOUNT1 AMOUNT2 AMOUNT3 ... Difference: And here I'd display the difference of the two above values. . . . . . ... . . . . . ... . . . . . ...
Any help, greatly appreciated.This message has been edited. Last edited by: <José Andrés Vargas Aguilar>,
Hy, recap can be usefull when calculating custom sums or percentages between columns.
But on this case I need to calculate the difference (that is A - B) between two rows. I know that on my By I'll always have two dates, not more. And I need to show amount_of_date_1 - amount_of_date_2.
ACROSS FIELD TYPE 1 TYPE 2 TYPE 3 ... BY1 DATE1 AMOUNT1 AMOUNT2 AMOUNT3 ... DATE2 AMOUNT1 AMOUNT2 AMOUNT3 ... BY2 DATE1 AMOUNT1 AMOUNT2 AMOUNT3 ... DATE2 AMOUNT1 AMOUNT2 AMOUNT3 ... . . . . . ... . . . . . ... . . . . . ...
And I need something like this:
ACROSS FIELD TYPE 1 TYPE 2 TYPE 3 ... BY1 DATE1 AMOUNT1 AMOUNT2 AMOUNT3 ... DATE2 AMOUNT1 AMOUNT2 AMOUNT3 ... Difference: And here I'd display the difference of the two above values. BY2 DATE1 AMOUNT1 AMOUNT2 AMOUNT3 ... DATE2 AMOUNT1 AMOUNT2 AMOUNT3 ... Difference: And here I'd display the difference of the two above values. . . . . . ... . . . . . ... . . . . . ...
Basic WF doesn't do inter-row calculations very well unless you use FML (lots of examples of that on the forum and in the manuals.)
However, what you're showing doesn't seem to require that. You can make whatever calculation you want and just put them in a subfoot. Using Ginny's suggestion of the LAST function calculate amount - last amount and then show it in a subfoot on the next line.
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
DEFINE FILE CAR
SEAT_BUCKET/A1 = IF SEATS GE 4 THEN 'B' ELSE 'A';
END
TABLE FILE CAR
SUM
DEALER_COST
RETAIL_COST
COMPUTE DEALER_COST_A/D10 = IF SEAT_BUCKET EQ 'A' THEN DEALER_COST ELSE 0; NOPRINT
COMPUTE RETAIL_COST_A/D10 = IF SEAT_BUCKET EQ 'A' THEN RETAIL_COST ELSE 0; NOPRINT
COMPUTE DEALER_COST_B/D10 = IF SEAT_BUCKET EQ 'B' THEN DEALER_COST ELSE 0; NOPRINT
COMPUTE RETAIL_COST_B/D10 = IF SEAT_BUCKET EQ 'B' THEN RETAIL_COST ELSE 0; NOPRINT
BY COUNTRY
BY SEAT_BUCKET NOPRINT
ON COUNTRY RECAP
DEALER_DIFF/D12 = DEALER_COST_B - DEALER_COST_A;
RETAIL_DIFF/D12 = RETAIL_COST_B - RETAIL_COST_A;
ON COUNTRY SUBFOOT
"Difference <DEALER_DIFF<RETAIL_DIFF"
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
TYPE=SUBFOOT, BY=COUNTRY, HEADALIGN=BODY, JUSTIFY=RIGHT, $
END
It'll hopefully give you some ideas you can apply to your particular need.
Although your solution didn't work for me it got me thinking on how to make it with FML.
And I managed to make it.
After all my accross's and BY's y just added some FML for the 2 rows of dates (dates I know 'cause they're part of the parameters of the report).
FOR FECHATEXTO '&wf_fchref1' AS '&wf_fchref1' LABEL R1 OVER '&wf_fchref2' AS '&wf_fchref2' LABEL R2 OVER BAR AS '-' OVER RECAP R4 = R1 - R2; AS 'Diferencia' OVER BAR AS '='