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 am now facing one issue about aggregation in WebFOCUS. Below is the description:
In WebFOCUS report, I would like to add up the value of (QUANTITY * UNIT_PRICE).
WebFOCUS
TABLE FILE TABLE_1
SUM
COMPUTE FIELD_1/D12.2 = QUANTITY * UNIT_PRICE;
BY CUSTOMER_ID
END
To improve the performance, the aggregation should be done in database level. However when I ran the report with the above code, I got the below log:
SQL code generated by WebFOCUS
SELECT
T1.CUSTOMER_ID,
SUM(T1.QUANTITY),
SUM(T1.UNIT_PRICE)
FROM TABLE_1 T1
GROUP BY
T1.CUSTOMER_ID
ORDER BY
T1.CUSTOMER_ID
Can you please guide how to execute aggregation for the calculation (QUANTITY * UNIT_PRICE) in database level? Thanks in advance!This message has been edited. Last edited by: <Emily McAllister>,
WebFOCUS 8105 Windows, All Outputs
Posts: 26 | Location: Hefei,China | Registered: March 27, 2016
Please note that most relational adapters translate Define to SQL:
DEFINE FILE wfretail81/wf_retail_lite
Define_1/D12.2=WF_RETAIL_LITE.WF_RETAIL_SALES.GROSS_PROFIT_US / WF_RETAIL_LITE.WF_RETAIL_SALES.DISCOUNT_US ;
END
TABLE FILE wfretail81/wf_retail_lite
SUM Define_1
BY WF_RETAIL_LITE.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY
END
SELECT
T7."PRODUCT_CATEGORY",
SUM((T1."GROSS_PROFIT_US" / T1."DISCOUNT_US"))
FROM
( wrd_wf_retail_sales T1
LEFT OUTER JOIN wrd_wf_retail_product T7
ON T7."ID_PRODUCT" = T1."ID_PRODUCT" )
GROUP BY
T7."PRODUCT_CATEGORY"
ORDER BY
T7."PRODUCT_CATEGORY";
Define will translate to, depending on the logic in it, to SQL.
Even IF statement will be converted to CASE. But you have to test all of it. Not all WebFocus statements are translated to SQL. ( depending on your data-provider and adapter I guess ).
_____________________ WF: 8.0.0.9 > going 8.2.0.5
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010
S.G, You are saying that you want the database to perform the COMPUTE due to performance issues (large volume of data). But since there are no WHERE clauses in your queries, you are going to get the same # of rows back regardless of where the math is performed. If you have 5 million CUSTOMER_IDs you will get back 5 million rows. Having the additional column will only introduce trivial extra cycles, most of the work is done retrieving those 5 million rows.
But otherwise, I also agree with Eran's suggestion of converting to DEFINE.