Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Aggregate of parent field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Aggregate of parent field
 Login/Join
 
<Tom Pettit>
posted
I am sure the answer for this is somewhere on these forums but I must not be using the correct terms. I think my biggest problems come because I used Crystal reports for many years and I still think in those terms. But I am sure there is nothing I did in Crystal that can't be done easily in webfocus, so here is a simple version of my scenario:

2 tables in a SQL Server with a parent/child relationship based on INVOICEID:

INVOICE

INVOICEID
INVOICEDATE
INVOICETOTAL
MERCHANTFEE

INVOICEITEM

INVOICEITEMID
INVOICEID
ITEMAMOUNT
ITEMWHOLESALE

I have a view in SQL server that combines those two tables, which means the fields from the INVOICE table are repeated for each INVOICEITEM record. This means that when I sum ITEMAMOUNT and ITEMWHOLESALE, the totals are correct, but when I sum INVOICETOTAL or MERCHANTFEE the total or too high.

In Crystal I was able to group by MONTH and then INVOICEID, put INVOICETOTAL and MERCHANTFEE in the INVOICEID group header next to the SUM of ITEMAMOUNT and ITEMWHOLESALE, then hide both the detail and the entire INVOICEID group, and only display the MONTH group data, which included the correct SUM of INVOICETOTAL and MERCHANTFEE from the group headers, and also the SUM of ITEMAMOUNT and ITEMWHOLESALE from the detail.

Hopefully my description makes sense to someone here. I know that there are many ways to approach this - I have tried a lot of things - but my tables are large so I need the join to be handled by SQL server.
 
Report This Post
Virtuoso
posted Hide Post
What result (and what SQL code) does Focus generate for a multiverb request along these lines? --
SUM INVOICETOTAL BY INVOICEID
SUM ITEMAMOUNT   BY INVOICEID BY INVOICEITEMID
ON TABLE HOLD FORMAT FOCUS


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
<Tom Pettit>
posted
JG,

That code will return a correct sum for ITEMAMOUNT but the SUM of INVOICETOTAL will be INVOICETOTAL multiplied by the number of invoiceitem records.
 
Report This Post
<Tom Pettit>
posted
OK - here is another approach and the problem I have with this approach:

SUM
MAX.INVOICETOTAL
MAX.MERCHANTFEE
ITEMAMOUNT
ITEMWHOLESALE
BY INVOICEDATE
BY INVOICEID

This approach gives me the correct data, but I need a summary report and do not want to see every invoice on this report.

I only need the daily (or monthly) totals, but when I add subotals and take out BY INVOICEID the data is wrong, or if I NOPRINT the columns, then the subtotals and grand totals are gone - the lines for the subtotals appear but with no columns.
 
Report This Post
Virtuoso
posted Hide Post
Tom,

If you can have Focus do the JOIN your problem would disappear because then your INVOICE data would be used once for every invoice.
If this is not feasible, then maybe you can
  
SUM 
MAX.INVOICETOTAL
MAX.MERCHANTFEE
ITEMAMOUNT
ITEMWHOLESALE
BY INVOICEDATE
BY INVOICEID
ON TABLE HOLD
END
TABLE FILE HOLD
SUM 
INVOICETOTAL
MERCHANTFEE
ITEMAMOUNT
ITEMWHOLESALE
BY INVOICEDATE
...


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, 2006Report This Post
<Tom Pettit>
posted
Thanks Danny - you have pinpointed the issues.

I guess I did not mention that when I let Webfocus handle the join, the performance was terrible whenever anyone choose more than about a week of data because of the amount of data. That is why I am trying to push the join to SQL server. Ideally I would push the aggregation to SQL server as well, but there are several calculations that have to be done at the invoice level which I need to keep in Webfocus.

2) Your solution of creating a HOLD file would definitely work fine for this. FOr some reason I have an irrational aversion to creating HOLD files and I need to get over that - I have rarely needed then in other reporting tools, but I know that the tool itself was doing that in the background for me.

In this case, your solution is exactly what I needed - load the detail in a hold file with the calculations I need at the invoice level, and then summarize using that data. If there is no way to do that in a single step by just 'hiding' or supressing the details and showing only the the summary data, then I will use this solution.
 
Report This Post
Virtuoso
posted Hide Post
Tom,
Welcome to the world of Focus. You will see that HOLD files, SAVE files are the everyday fare. Use them well as they have lots of power.
The other hugely powerful tool in WF is the Dialog Manager. Understand that and you will never look back!


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, 2006Report This Post
Expert
posted Hide Post
Tom,

You mention that you have large amounts of data, don't forget to utilise RECORDLIMIT and / or READLIMIT during testing to speed up your turn around rate between runs. Also, XRETRIEVAL can be very useful in trapping the SQL to determine how the join is being handled.

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, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Aggregate of parent field

Copyright © 1996-2020 Information Builders