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 fex that makes a union of two queries. One of them counts credits in a bank, the other one sums the amount of money granted on the same credits.
Each one has a column named DATO wich carries the "Quantity: " value on the first case and the "Amount: " value on the second case (always). So I make a BY DATO and my data gets displayed something like this:
I don't use OVER much so I don't know if it would give you TOTALs in 2 lines similar to the detail data but you might try to use that one instead. If it worked though, then you would't even need to make a union of files but just keep 2 independent fields for QUANTITY and AMOUNT and print one OVER the other.This message has been edited. Last edited by: njsden,
FYI, the previous, previous post has the labels in spanish.
Here is some of my code that may help you find an answer:
TABLE FILE SQLOUT
SUM
MONTOS NOPRINT
MORA7 NOPRINT
MORA30 NOPRINT
SALDOS NOPRINT
SALDO7 NOPRINT
SALDO30 NOPRINT
CANTS NOPRINT
CANT7 NOPRINT
CANT30 NOPRINT
SUM
MONTOS NOPRINT
MORA7 NOPRINT
MORA30 NOPRINT
SALDOS NOPRINT
SALDO7 NOPRINT
SALDO30 NOPRINT
CANTS NOPRINT
CANT7 NOPRINT
CANT30 NOPRINT
BY &wf_agrupa
BY DATO
SUM
MONTOS AS ''
BY &wf_agrupa
BY DATO
ACROSS MORAMIN NOPRINT
ACROSS DIA AS 'Dias de Mora'
COMPUTE COL0/D20.2 = C10; AS 'TOTAL'
COMPUTE COL1/D20.2% = IF DATO EQ 'Saldo: ' THEN 100*C13/C4 ELSE 100*C16/C7; AS '% CONCENT.'
COMPUTE COL2/D20.2% = IF DATO EQ 'Saldo: ' THEN 100*C14/C13 ELSE 100*C17/C16; AS 'MORA 7 DIAS'
COMPUTE COL3/D20.2% = IF DATO EQ 'Saldo: ' THEN 100*C15/C13 ELSE 100*C18/C16; AS 'MORA 30 DIAS'
Yes, the labels are in spanish and yes, I'm aware that some columns (like C11 and C12) are not being used. Please ignore that for a while.
As you can see all I need is a total for "Cantidad: " (i.e. quantities) and another one for "Saldo: " (i.e amounts).
Well José Andrés, you had missed a very important piece of the puzzle when you first posted the question as the technique I described is not really "ACROSS-friendly".
For what you're trying to achieve, I'd probably just produce a small "report" with totals only appending it to the HOLD file. Then I'd run a report out of the final HOLD.This message has been edited. Last edited by: njsden,
SET HOLDLIST=PRINTONLY
SET ASNAMES=ON
FILEDEF HRESULTS DISK hresults.ftm (APPEND
-* Get quantities
DEFINE FILE CAR
GRP_SEQ/I2 = 1;
ITEM_SEQ/I2 = 1;
ITEM_LBL/A20 = 'Quantity';
DATO/D20 = SALES;
END
TABLE FILE CAR
SUM DATO
ACROSS CAR
BY COUNTRY
BY GRP_SEQ
BY ITEM_SEQ
BY ITEM_LBL
ON TABLE HOLD AS HRESULTS
END
-* Get amounts
DEFINE FILE CAR
GRP_SEQ/I2 = 1;
ITEM_SEQ/I2 = 2;
ITEM_LBL/A20 = 'Amount';
DATO/D20 = RETAIL_COST;
END
TABLE FILE CAR
SUM DATO
ACROSS CAR
BY COUNTRY
BY GRP_SEQ
BY ITEM_SEQ
BY ITEM_LBL
ON TABLE HOLD AS HRESULTS
END
-* Calculate total quantity
DEFINE FILE CAR
CTRY/A10 = 'Total';
GRP_SEQ/I2 = 2;
ITEM_SEQ/I2 = 1;
ITEM_LBL/A20 = 'Quantity';
DATO/D20 = SALES;
END
TABLE FILE CAR
SUM DATO
ACROSS CAR
BY CTRY AS 'COUNTRY'
BY GRP_SEQ
BY ITEM_SEQ
BY ITEM_LBL
ON TABLE HOLD AS HRESULTS
END
-* Calculate total amount
DEFINE FILE CAR
CTRY/A10 = 'Total';
GRP_SEQ/I2 = 2;
ITEM_SEQ/I2 = 2;
ITEM_LBL/A20 = 'Amount';
DATO/D20 = RETAIL_COST;
END
TABLE FILE CAR
SUM DATO
ACROSS CAR
BY CTRY AS 'COUNTRY'
BY GRP_SEQ
BY ITEM_SEQ
BY ITEM_LBL
ON TABLE HOLD AS HRESULTS
END
-* Produce report
TABLE FILE HRESULTS
PRINT *
BY GRP_SEQ NOPRINT
BY COUNTRY NOPRINT
BY ITEM_SEQ NOPRINT
ON TABLE SET STYLE *
TYPE=DATA, STYLE=BOLD, WHEN=GRP_SEQ EQ 2, $
ENDSTYLE
END
It's not pretty but it will hopefully illustrate the idea. You will need to tweak it in order to print the exact fields you want as opposed to resorting to PRINT * as I did in my example. Using ACROSS when creating HOLD files does not make life any easier but some Dialog Manager magic will probably give you a hand there.
Following this solution I'd make my normal fex and save it in a HOLD. Afterwards I'd make the same query again, totalize it and save it on the same HOLD.
But as is usual there are some business rules that makes this a bit more difficult. On my parameters screen the user can pick one of several groupers which (is that word well writen?) then turn into that BY &wf_agrupa you can see on the code I printed here some posts ago.
Is there a way to make reference to the columns of the HOLD file?
I'd need to substitute the value of the first column (the one this "dynamic" BY grouper) in all records of the SQLOUT recordset for a generic value so it would allow me to make grouping on my totalizer script.
It would be ideal If WF were able to make references to the HOLD dataset like if it were an array. Something like:
DEFINE FILE MYHOLD HOLD(1) = 'new value'; END
That would be superb (or anything similar).
Thanks!
Best regards, wf newbie.This message has been edited. Last edited by: <José Andrés Vargas Aguilar>,
I think you are making this much harder than it needs to be. Have you checked out RECAP?
In response to referencing the columns of your HOLD file, you can join to it (if it isn't indexed it needs to be in the same sort order as the host file). ?FF HOLD (or whatever you have named the file) will give you a list of all available columns in the file, their aliases and formats.
Pat WF 7.6.8, AIX, AS400, NT AS400 FOCUS, AIX FOCUS, Oracle, DB2, JDE, Lotus Notes
Posts: 755 | Location: TX | Registered: September 25, 2007
Neftali, your suggestion works perfectly but on our infrastructure it does only for "little" recordsets. On this particular pase the maximum verb statements on Webfoucs gets overflowed.
Anyway it's a pretty clever idea, thanks.
I also tried to do it using the Report Composer but again, the queried recordset is too big.
Ultimately I delivered the report having Amounts a Quantities as columns and not as rows.