Print Page | Close Window

Argument #1 of DateDiff is out of range

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=13723
Printed Date: 28 Apr 2024 at 7:19am


Topic: Argument #1 of DateDiff is out of range
Posted By: gizmosilly
Subject: Argument #1 of DateDiff is out of range
Date Posted: 12 Jul 2011 at 11:27am

I am trying to get the time difference from one process to the next when I put in my formula it is giving me an out of range error message below is my formula

datediff('MM,DD,YYYY,HH,MM,SS',
(datetime(year(Minimum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          month(Minimum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Day(Minimum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})))),
(datetime(year(Maximum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          month(Maximum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Day(Maximum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})))))
 
This is the date appears
5/5/2011 10:57:21AM
Please let me know what I am doing wrong
Thanks
 



Replies:
Posted By: DBlank
Date Posted: 12 Jul 2011 at 11:33am
datediff('MM,DD,YYYY,HH,MM,SS',
You have to select one value from the red list. Do youwant to see the differnce in month or day or years etc.


Posted By: gizmosilly
Date Posted: 13 Jul 2011 at 3:36am
I selected HH from the list and that did not work so then I selected MM that still did not work so then I added the Hours Minutes and Seconds to my formula and that still does not work it still says that argument 1 is out of range (what I am looking to compare is the amount of time in hours or minutes that it took to go from one process to another) 
 
datediff ('HH',
(Datetime(year(Minimum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Month(Minimum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Day(Minimum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Hour(Minimum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Minute(Minimum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Second(Minimum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})))),
(Datetime(year(Maximum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Month(maximum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Day(Maximum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Hour(Maximum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Minute(Maximum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})),
          Second(Maximum ( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE})))))


Posted By: DBlank
Date Posted: 13 Jul 2011 at 4:13am

sorry,, many of your values were not valid and I did ot point that out...

h is for hours and n is for minutes.
 
I do not know what your 'process' is that youa re checking time differences but I would assume it is in a group sop your group level formula would look something like this (for minutes)...
 
datediff('n', minimum( mailto:%7b@Date - {@Date Time}, {Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE}), maximum{Billing_Cycle_Process_Tag_File.DocumentOrderInvoiceE}))


Posted By: gizmosilly
Date Posted: 13 Jul 2011 at 8:19am
That worked thanks for everything!



Print Page | Close Window