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 a report that is setup similar to the example below. I need to calculate the difference between the two quarter total and then I need to calculate the change percentage. I figure if I can figure out how to calculate the difference the change percentage shouldn't be that hard. I tried using FML, but the FOR statement only allows one field and I need to have it group by two different fields with one of the fields being a NOPRINT subtotal. I'm building the report in App Studio.
DEFINE FILE GGSALES
DATE_YYMD/YYMD=DATECVT(DATE, 'I8YYMD', 'YYMD');
DATE_YYQ/YYQ=FIYYQ(DATE_YYMD, 'D', 1, 1, 'FYE', DATE_YYQ);
END
TABLE FILE GGSALES
SUM
DOLLARS/P12.2CM
AVE.DOLLARS/P12.2CM AS 'Avg Dollar Sales'
BY LOWEST CATEGORY NOPRINT
BY PCD
ACROSS LOWEST DATE_YYQ AS ''
ON CATEGORY SUBTOTAL AS ''
WHERE ( DATE GE 19960101 ) AND ( DATE LE 19960630 );
WHERE RECORDLIMIT EQ 5000
ON TABLE SET SUBTOTALS ABOVE
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END
Any help would be greatly appreciated.
Thanks,
RalphThis message has been edited. Last edited by: <Kathryn Henning>,
WF Version: 8.1.05 Platform: Windows Outputs: HTML, PDF, Excel
Posts: 4 | Location: Kansas City, MO | Registered: May 18, 2015
Using your exact example, you can add COMPUTEs after the ACROSS verb to add columns to the right of your code but this may not be what you want. Especially as you (I am guessing) only want the difference and percentage at CATEGORY (SUBTOTAL) level?
Remember that the single value in the FOR syntax does not prevent you from using a compound value made from two or more sort values and that is probably the way that I would go - if I knew more about the required end result. I would also trap the SQL if this is against an RDBMS to ensure that it is efficient.
Anyway, try this version of your code. Note that the column notation (C1, C3 etc.) are not what you expect because of the dynamic reformatting and the resultant internal matrix created.
DEFINE FILE GGSALES
DATE_YYMD/YYMD=DATECVT(DATE, 'I8YYMD', 'YYMD');
DATE_YYQ/YYQ=FIYYQ(DATE_YYMD, 'D', 1, 1, 'FYE', DATE_YYQ);
END
TABLE FILE GGSALES
SUM
DOLLARS/P12.2CM
AVE.DOLLARS/P12.2CM AS 'Avg Dollar Sales'
BY LOWEST CATEGORY NOPRINT
BY PCD
ACROSS LOWEST DATE_YYQ AS ''
COMPUTE DOLL_QTRDIFF/P12.2CM = C1 - C5; AS 'Difference'
COMPUTE DOLL_QTRPCENT/D6.2% = (C1 - C5) / C1 * 100; AS '% Diff'
ON CATEGORY SUBTOTAL AS ''
WHERE ( DATE GE 19960101 ) AND ( DATE LE 19960630 );
WHERE RECORDLIMIT EQ 5000
ON TABLE SET SUBTOTALS ABOVE
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END
Good luck
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Thanks for the information Tony, it worked. I thought I tried using the C# and it didn't work. Maybe I had the compute statement in the wrong place. I did want the difference at the detail and subtotal level so this work. I think this will work for now. I may need to play with FML a little more and then may change this report to use FML.
Once agian, thanks.
WF Version: 8.1.05 Platform: Windows Outputs: HTML, PDF, Excel
Posts: 4 | Location: Kansas City, MO | Registered: May 18, 2015