Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Can Formula be used as COMMAND parameter? Post Reply Post New Topic
Author Message
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Topic: Can Formula be used as COMMAND parameter?
     Posted: 16 Sep 2014 at 8:05am
if you create one date param in the command you can use
datediff(month,param,datefield)=0
in your where clause
your users only have select a day within the year and moth they want to see.
IP IP Logged
statey603
Groupie
Groupie
Avatar

Joined: 14 Aug 2013
Online Status: Offline
Posts: 78
Quote statey603 Replybullet Posted: 16 Sep 2014 at 10:03am
I ended up taking a different approach and used a subreport.
I was deleting the post when you posted.
 I will repost the original and my workaround (below).
thanks, that is a good way to handle it as well.
 
-bill
IP IP Logged
statey603
Groupie
Groupie
Avatar

Joined: 14 Aug 2013
Online Status: Offline
Posts: 78
Quote statey603 Replybullet Posted: 16 Sep 2014 at 10:04am
original issue
I have a report that needs to be run for a complete month. As part of the requirement, I cannot rely on the user to enter a valid date range. Therefore, I am thinking of using a dropdown parameter where the user will select a month and then a numeric parameter for the user to specify a year. I have formulas and shared variables to get the determine the actual date range.
For example: [May 1, 2014 - May 31, 2014]
[Jun 1, 2013 - Jun 30, 2013]
Is there a way to pass these formula result variable values to my main COMMAND to be used in my WHERE clause ?

I appreciate any assistance with how to accomplish this and/or any suggestions on alternate ways to achieve a report that executes for a single month date range specified by the user as described above.

Thanks

-bill
IP IP Logged
statey603
Groupie
Groupie
Avatar

Joined: 14 Aug 2013
Online Status: Offline
Posts: 78
Quote statey603 Replybullet Posted: 16 Sep 2014 at 10:05am
MY WORKAROUND
 
I came up with a solution to this in case anyone else runs into a similar situation.

I created a new, blank report.
I inserted my original report as a sub-report in the detail section of the main report and suppressed all of the main report sections except for the detail section.

I added the needed input Parameters (described in original post) to the main report.
- Month dropdown list
- Year
- Vendor #
I took the formulas that determine the Start and End Dates [from month/year params] out of the subreport and put them in my main report.
I joined the subreport and the main report [via subreport links] as follows:
Main report formula getBgnDate linked to subreport RptBgnDate parameter
Main report formula getEndDate linked to subreport RptendDate parameter
Main report parameter Vendor # linked to subreport Vendor # parameter
The subreport uses the parameters in its COMMAND.

-bill
IP IP Logged
Printable version Printable version

Forum Jump
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