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     [SOLVED] CASE DIFFICULT TO EXPLAIN - SEE JOIN EXAMPLE

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] CASE DIFFICULT TO EXPLAIN - SEE JOIN EXAMPLE
 Login/Join
 
Gold member
posted
Hello Webfocus Users,
I have a problem witch is difficult to explain for me, so I prepared an example with Employee table.

If you execute the following lines, you obtain 2 data lines for field "number of months" equal to 401 and a totalisation line *TOTAL 401.

the value of field amount by month is : 21780 + 9000 = 30 780 / (401 + 401) = 38,38

The number of months is summed and I don't want. I want 30780/401 = 76,76 as result on the total line.

How can I do that ? (if the field number_of_months is in first position in the BY list,it works but in my case, the field can not be in first position).
Thanks a lot for answers.
Catherine

-SET &END_DATE = '09072015';

DEFINE FILE EMPLOYEE
NEW_HIRE_DATE/YYMD = DATECVT(HIRE_DATE, 'I6YMD', 'YYMD');
NEW_DAT_INC/YYMD = DATECVT(&END_DATE, 'I8MDYY', 'YYMD');
NUMBER_OF_MONTHS/I8 = DATEDIF(NEW_HIRE_DATE, NEW_DAT_INC, 'M');
END

TABLE FILE EMPLOYEE
SUM
'EMPLOYEE.EMPINFO.NEW_HIRE_DATE'
'EMPLOYEE.EMPINFO.CURR_SAL/D12.2!e'
COMPUTE amount_by_month/D12.2 = EMPLOYEE.EMPINFO.CURR_SAL / EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS;
BY 'EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS'
BY 'EMPLOYEE.EMPINFO.DEPARTMENT'
BY 'EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS'
BY 'EMPLOYEE.EMPINFO.LAST_NAME'
BY 'EMPLOYEE.EMPINFO.FIRST_NAME'
WHERE DEPARTMENT EQ 'MIS';
ON EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS SUBTOTAL RECOMPUTE AS '*TOTAL'
ON TABLE NOTOTAL
END

This message has been edited. Last edited by: <Kathryn Henning>,


7.7.02 (Html, Excel, Ahtml, Pdf,Graph,.....)
OS400 V5R3, V5R4
Windows 2000/2003/2007/2010
 
Posts: 68 | Location: France | Registered: February 27, 2008Report This Post
Virtuoso
posted Hide Post
Just remove the RECOMPUTE from the SUBTOTAL line
-SET &END_DATE = '09072015';

DEFINE FILE EMPLOYEE
NEW_HIRE_DATE/YYMD = DATECVT(HIRE_DATE, 'I6YMD', 'YYMD');
NEW_DAT_INC/YYMD = DATECVT(&END_DATE, 'I8MDYY', 'YYMD');
NUMBER_OF_MONTHS/I8 = DATEDIF(NEW_HIRE_DATE, NEW_DAT_INC, 'M');
END

TABLE FILE EMPLOYEE
SUM
 'EMPLOYEE.EMPINFO.NEW_HIRE_DATE'
 'EMPLOYEE.EMPINFO.CURR_SAL/D12.2!e'
 COMPUTE amount_by_month/D12.2 = EMPLOYEE.EMPINFO.CURR_SAL / EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS;
-*BY 'EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS'
BY 'EMPLOYEE.EMPINFO.DEPARTMENT'
BY 'EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS'
BY 'EMPLOYEE.EMPINFO.LAST_NAME'
BY 'EMPLOYEE.EMPINFO.FIRST_NAME'
WHERE DEPARTMENT EQ 'MIS'; 
ON EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS SUBTOTAL  AS '*TOTAL'
ON TABLE NOTOTAL
END


Is that what you're looking for ?


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Gold member
posted Hide Post
Tkanks for the answer.
But I need to have RECOMPUTE because in my real case, I have other computed field for percentage calculation.


7.7.02 (Html, Excel, Ahtml, Pdf,Graph,.....)
OS400 V5R3, V5R4
Windows 2000/2003/2007/2010
 
Posts: 68 | Location: France | Registered: February 27, 2008Report This Post
Virtuoso
posted Hide Post
Does this suits more your need ?
-SET &END_DATE = '09072015';

DEFINE FILE EMPLOYEE
NEW_HIRE_DATE/YYMD = DATECVT(HIRE_DATE, 'I6YMD', 'YYMD');
NEW_DAT_INC/YYMD = DATECVT(&END_DATE, 'I8MDYY', 'YYMD');
NUMBER_OF_MONTHS/I8 = DATEDIF(NEW_HIRE_DATE, NEW_DAT_INC, 'M');
END

TABLE FILE EMPLOYEE
-*SUM 'EMPLOYEE.EMPINFO.CURR_SAL/D12.2!e' NOPRINT
-*    COMPUTE amount_by_month/D12.2 = EMPLOYEE.EMPINFO.CURR_SAL / FST.EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS; NOPRINT
BY 'EMPLOYEE.EMPINFO.DEPARTMENT'
BY 'EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS'
WHERE DEPARTMENT EQ 'MIS'; 

PRINT 'EMPLOYEE.EMPINFO.NEW_HIRE_DATE'
      'EMPLOYEE.EMPINFO.CURR_SAL/D12.2!e'
      COMPUTE amount_by_usermonth/D12.2 = EMPLOYEE.EMPINFO.CURR_SAL / EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS;
BY 'EMPLOYEE.EMPINFO.DEPARTMENT'
BY 'EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS'
BY 'EMPLOYEE.EMPINFO.LAST_NAME'
BY 'EMPLOYEE.EMPINFO.FIRST_NAME'
WHERE DEPARTMENT EQ 'MIS'; 
ON EMPLOYEE.EMPINFO.NUMBER_OF_MONTHS SUBTOTAL RECOMPUTE AS '*TOTAL'
ON TABLE NOTOTAL
END


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Guru
posted Hide Post
  
-SET &END_DATE = '09072015';

DEFINE FILE EMPLOYEE
NEW_HIRE_DATE/YYMD = DATECVT(HIRE_DATE, 'I6YMD', 'YYMD');
NEW_DAT_INC/YYMD = DATECVT(&END_DATE, 'I8MDYY', 'YYMD');
NUMBER_OF_MONTHS/I8 = DATEDIF(NEW_HIRE_DATE, NEW_DAT_INC, 'M');
END

TABLE FILE EMPLOYEE
SUM
   NEW_HIRE_DATE
   CURR_SAL/D12.2!e
   COMPUTE cnt/I11 = CNT.NUMBER_OF_MONTHS; 
   COMPUTE amount_by_month/D12.2 = CURR_SAL / (NUMBER_OF_MONTHS/cnt);
BY NUMBER_OF_MONTHS
BY DEPARTMENT
BY NUMBER_OF_MONTHS
BY LAST_NAME
BY FIRST_NAME
WHERE DEPARTMENT EQ 'MIS';
ON NUMBER_OF_MONTHS SUBTOTAL RECOMPUTE AS '*TOTAL'
ON TABLE NOTOTAL
END


WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
 
Posts: 320 | Location: Memphis, TN | Registered: February 12, 2008Report This Post
Gold member
posted Hide Post
Thank you so much (merci beaucoup in french) for your answer.
I used the Mighty Max solution and it's exactly what I need.
Catherine


7.7.02 (Html, Excel, Ahtml, Pdf,Graph,.....)
OS400 V5R3, V5R4
Windows 2000/2003/2007/2010
 
Posts: 68 | Location: France | Registered: February 27, 2008Report 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     [SOLVED] CASE DIFFICULT TO EXPLAIN - SEE JOIN EXAMPLE

Copyright © 1996-2020 Information Builders