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.
The difference between a define and a compute , is that , compute are being performed on the result set and defines on the table , in short define are executed before any where clauses or by statements have been processed.
Hope this helps a bit
P.
D: WF 7.6.2 P. : WF 7.6.2 on W2003 ------------------------------------------------------------------ I see myself as an intelligent, sensitive human, with the soul of a clown which forces me to blow it at the most important moments.
D: WF 7.6.2 P. : WF 7.6.2 on W2003 ------------------------------------------------------------------ I see myself as an intelligent, sensitive human, with the soul of a clown which forces me to blow it at the most important moments.
The definition Pete gave you and the link Prairie sent you to both explain the differences between a Define and a Compute.
Another tip would be to download a copy of "Creating Reports With WebFOCUS Language" for your version and do a search on "Compute" and "Define". You will learn what you can and cannot do with each type of temporary field as well as pick up other useful pieces of information you can use in WebFOCUS such as "tiling".
You can use a temporary field created by a DEFINE command, or by the DEFINE attribute in a Master File, as a sort field. However, you cannot use a temporary field created by a COMPUTE command as a sort field UNLESS you first creating a HOLD file that includes the field, and then reporting from the HOLD file.
The COMPUTE command cannot be used to create a tile field.
I had no idea about tiling until I began searching for "Define" versus "Compute". So search away and it will open up avenues you have yet to consider.
1) DEFINE : Works on each row retrieved 2) COMPUTE: Works on summarized level of data
E.G. When calcualting TAX on a sales receipt, TAX has to calculated on a line item basis, this accomodates products that are non-tax rated:. use DEFINE If you were to use a COMPUTE and summarised the receipt to transaction level, then tax would be calculated on the total not just those items which were non-zero rated.
P
Posts: 42 | Location: UK | Registered: October 23, 2005
FOCUS processes things using an Internal Matrix. There are a number of steps on what the order of operations are in this matrix but basically, a DEFINE will create these types of temporary fields for each row in the database. If you have 2millions rows in the db, then the temp fields created this way will have 2mil also. These types are done on a line-by-line instance.
A COMPUTE uses only the values that have been summed down by the BY statements. They are more efficient because there are less rows in the matrix at this point, but they are also summed, meaning you will not get the same results as a DEFINE. Any WHERE tests MUST use WHERE TOTAL.
I have some examples from a class that I taught if you need more details. Carol
------------------------------------------ last version used: v7.1; truly miss the wonderful things I did with WebFOCUS, HTML, & JavaScript.
Posts: 36 | Location: Rolling Meadows, IL | Registered: September 05, 2007
My intent was not to correct you. I sincerely apologize if that is what you took my response to be. I also did not find an error in the manual. What the manual states is 100% correct. This is also not an undocumented and unsuported feature. You really can't sort a computed field using just a BY. But I used "BY TOTAL".
My intent was really to point out that "BY TOTAL" can sometimes be used to in effect sort a computed field resulting in one physical pass through the data and could be viewed as a tip/technique item that the FOCUS community may not be aware of. (A parallel to this is "if/where total" against a computed field can act like screening against a defined field).
In my case the computed field involved nested if/then/else logic against a large joined db2 table structure returning millions of rows. If I had used a define and then sorted by the defined field, then the request resulted in the join not being passed to db2 (just selects and focus then had to manage the join) making it piggy and inefficient. Using a compute and then holding and passing the hold file would mean I would have to write millions of records once and then read, sort and write it out again. Using "BY TOTAL" I did it all in one pass.
ET
FOCUS 7.6 MVS PDF,HTML,EXCEL
Posts: 115 | Location: Chicago, IL | Registered: May 28, 2004
No insult taken. I learn through mistakes (and it usually only takes one time per mistake ). Actually, had I continued to search the manual for further occurrences of "compute", I would have come across the tidbit "by total".