| Author |
Message |
Jon K
Newbie
Joined: 12 Aug 2009
Location: United States
Online Status: Offline
Posts: 8
|

Topic: Changing Date parameter to 1st of month to "Today" Posted: 25 Jun 2013 at 2:28am |
|
Hi All,
I need to change a report from accepting a parameter/input of a date range to defaulting to "From the first of this month to today".
Currently it has this in the selection formula:
{CUSTOMER_ORDER.ORDER_DATE} = {?Order Date Range}
So if the report were run today, 6/25, I would need 6/1 - 6/25 automatically without prompt/parameter. Is this doable? Not a very good Crystal formula guy yet!
Thank for your help everyone
Jon
Edited by Jon K - 25 Jun 2013 at 2:35am
|
IP Logged |
|
|
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 25 Jun 2013 at 10:42am |
|
in the record selection formula:
local datetimevar fom := CDATE(year(today), month(today), 1);
if {table.dateField} in fom to today then
true
else
false
my syntax for the cdate() function may be off, just going be memory. Regardless, this would be the correct idea
HTH
|
IP Logged |
|
Jon K
Newbie
Joined: 12 Aug 2009
Location: United States
Online Status: Offline
Posts: 8
|

Posted: 25 Jun 2013 at 5:05pm |
|
Thanks Lockwelle - I will try this tomorrow!
|
IP Logged |
|
Jon K
Newbie
Joined: 12 Aug 2009
Location: United States
Online Status: Offline
Posts: 8
|

Posted: 26 Jun 2013 at 1:48am |
|
Lockwelle - here is my whole record selection:
{@Prime} and not({@Consignment}) and {@OrderSelect} and {@StatusSel} and local datetimevar fom := CDATE(year(today), month(today), 1); if {CUSTOMER_ORDER.ORDER_DATE} in fom to today then true else false //{CUSTOMER_ORDER.ORDER_DATE} = {?Order Date Range} and //{@StatusSel}
When I save and close I get an error on the line I highlighted saying "A boolean is required here."
Any thoughts?
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 26 Jun 2013 at 4:34am |
|
I would try something like this:
local datetimevar fom := CDATE(year(today), month(today), 1);
{@Prime} and
not({@Consignment}) and
{@OrderSelect} and
{@StatusSel} and
{CUSTOMER_ORDER.ORDER_DATE} in fom to today
//{CUSTOMER_ORDER.ORDER_DATE} = {?Order Date Range} and
//{@StatusSel}
declare the variable, then you can use it in the statement as completely boolean expression and CR should be happier.
HTH
|
IP Logged |
|
|
|