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] Age Calculations

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Age Calculations
 Login/Join
 
Guru
posted
I am trying to calculate age for dateof birthcloumn.
I have following code
DEFINE FILE STAGE_CHILD_POS
CURRENTDT/Y=&DATEYYMD;
Birthday/YYMD=HDATE(STAGE_CHILD_POS.STAGE_CHILD_POS.BIRTHDATE, 'YYMD');
AGE/D12.2=DATEDIF(Birthday, CURRENTDT, 'Y');
END

I am getting error message:
(FOC36355) INVALID TYPE OF ARGUMENT #2 FOR USER FUNCTION DATEDIF
What am I doing wrong?

Arif

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Guru
posted Hide Post
The field, CURRENTDT, is just a number. DATEDIF is expecting a date-formatted item.

If you just want to subtract the birth year from the current year, extract the birth year and do it arintmetically.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Virtuoso
posted Hide Post
If you're wanting to calculate age from a date of birth, you should be subtracting today's date and the date of birth. Just using today's year may or may not give you the correct age. It would depend on whether or not the birthday has already occurred in this year.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Master
posted Hide Post
Change your code as follows:

DEFINE FILE STAGE_CHILD_POS
  CURRENTDT/YYMD=&YYMD;
  Birthday/YYMD=HDATE(STAGE_CHILD_POS.STAGE_CHILD_POS.BIRTHDATE, 'YYMD');
  AGE/D12.2=DATEDIF(Birthday, CURRENTDT, 'Y');
END


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Platinum Member
posted Hide Post
Hi,

Can you use the following to determine age?

DEFINE FILE SOMETABLE  
AGE/I3=BIRTHDATE/365.25;
END


Best Regards,

Jimmy Pang


DEV: WF 7.6.10
TEST: WF 7.6.10
PROD: WF 7.6.10
MRE: WF 7.6.4
OS/Platform: Windows
Dev Studio: WF 7.7
Output: HTML, EXCEL, PDF, GRAPH, LOTUS, CSV
 
Posts: 117 | Location: Toronto, Ontario, Canada | Registered: February 29, 2008Report This Post
Guru
posted Hide Post
quote:
DEFINE FILE STAGE_CHILD_POS
CURRENTDT/YYMD=&YYMD;
Birthday/YYMD=HDATE(STAGE_CHILD_POS.STAGE_CHILD_POS.BIRTHDATE, 'YYMD');
AGE/D12.2=DATEDIF(Birthday, CURRENTDT, 'Y');
END

I think it was very helpful. I used
DEFINE FILE STAGE_CHILD_POS
CURRENTDT/YYMD=&YYMD;
Birthday/YYMD=HDATE(STAGE_CHILD_POS.STAGE_CHILD_POS.BIRTHDATE, 'YYMD');
AGE/D12.2=DATEDIF(Birthday, CURRENTDT, 'Y');
END

and it works just fine.


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Master
posted Hide Post
quote:
Can you use the following to determine age?

DEFINE FILE SOMETABLE
AGE/I3=BIRTHDATE/365.25;
END



Jimmy, you can do that if you want the wrong answer. What that calculation will give you is an estimate of the number of years since 1/1/1901. Smart dates (those with a format of YYMD or MDYY or DMYY, etc.) are stored internally as the number of days since 12/31/1900. -1 is 12/30/1900, 0 is 12/31/1900, 1 is 1/1/1901, 2 is 1/2/1901, etc. If Birthday is 7/13/2005, as an integer it is 38180, divide that by 365.25 you get 104.53... years.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Platinum Member
posted Hide Post
I see.

Thanks for your response to describe what it's actually doing in the calculation.

I better double check some old report as they may not be correct.

Thanks again.


DEV: WF 7.6.10
TEST: WF 7.6.10
PROD: WF 7.6.10
MRE: WF 7.6.4
OS/Platform: Windows
Dev Studio: WF 7.7
Output: HTML, EXCEL, PDF, GRAPH, LOTUS, CSV
 
Posts: 117 | Location: Toronto, Ontario, Canada | Registered: February 29, 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] Age Calculations

Copyright © 1996-2020 Information Builders