Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Topic: selectt range of current month +12 Posted: 22 Dec 2009 at 11:35am
I had a previous report where record dates were listed with a month and year. I had a formula from the wonderful folks here that allowed me to select the current month through the next 12 months. I now have a new report that has a full date field in it. I am trying to do the same type of filter of current month to 12 months out. Here is what I have, and no errors, but when I go to the select expert I am not getting the option to choose the formula and set to true.
numbervar MN; numbervar YN;
MN := Month(currentdate()); YN := Year(currentdate());
date(YN,MN,1)in dateadd('d',-(day(currentdate))+1,currentdate) to dateadd('m',12,dateadd('d',-(day(currentdate))+1,currentdate));
I am open to an easier way since I now have the full date to use if need be.
Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Posted: 22 Dec 2009 at 12:02pm
I found my solution. I am guessing since I setup variables etc. Crystal did not want to let me use it as part of the select. I modified the formula to:
date(Year(table.datefield),Month(table.datefield),1)in dateadd('d',-(day(currentdate))+1,currentdate) to dateadd('m',12,dateadd('d',-(day(currentdate))+1,currentdate));
and it worked, and that is also a more efficient way to do what I had anyway. :)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum