Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Creating a Parameter Report Based on Half Years Post Reply Post New Topic
Author Message
adavis
Senior Member
Senior Member


Joined: 30 Oct 2012
Online Status: Offline
Posts: 104
Quote adavis Replybullet Topic: Creating a Parameter Report Based on Half Years
    Posted: 31 May 2013 at 4:54am
I have been fiddling around with this report for a while now and have decided to finally breakdown and ask this forum. I know I am close, but just cannot quite get it.

I want a report that pulls mileage data for vehicles for the first or second half of the year. The problem I am having is that the database doesn't store data in quarters or halves, just dates (mm/dd/yyyy).

So, I created a formula that I titled Period, as follows:

if {EFFUEL_1.FU_DATE}= Calendar1stHalf then 1 else
if {EFFUEL_1.FU_DATE}= Calendar2ndHalf then 2 else
if {EFFUEL_1.FU_DATE}=YearToDate then 3

Then, I created a parameter that I titled Period, and made it a number (You may notice by now that I am following the advice given to another poster on the "tricky field" thread).

I then conditionally suppressed the groups in my section expert, as follows:

{@Period}<>{?Period}


This seems fairly simple and intuitive to me, however, when I enter a parameter value of 2 for the report, I am still getting data from the first half of the year instead of it running blank (which it should since it is not yet the second half of the year).

Does anyone have advice on where I went wrong?




EDIT:

I am a noob geek. I think I just needed to write it all out to figure out where I went wrong. I will post my correction here so that fellow noobs in the future can follow my methodology.



In my Select Expert, I entered:

(if {@Period} =1 then {EFFUEL_1.FU_DATE}=Calendar1stHalf else
if {@Period}=2 then {EFFUEL_1.FU_DATE}=Calendar2ndHalf else
if {@Period}=3 then {EFFUEL_1.FU_DATE}=YearToDate)


What I should have entered was:

(if {?Period} =1 then {EFFUEL_1.FU_DATE}=Calendar1stHalf else
if {?Period}=2 then {EFFUEL_1.FU_DATE}=Calendar2ndHalf else
if {?Period}=3 then {EFFUEL_1.FU_DATE}=YearToDate)


It is working correctly now.

Edited by adavis - 31 May 2013 at 5:14am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Jun 2013 at 4:06am

As an aside,

If-Then statements are not the best to use in the select expert. you could also use the below that will accomplish your needed output:
 
({?Period} =1 and {EFFUEL_1.FU_DATE} in Calendar1stHalf)
or
({?Period}=2 and {EFFUEL_1.FU_DATE} in Calendar2ndHalf)
or
({?Period}=3 and {EFFUEL_1.FU_DATE} in YearToDate)
 
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.033 seconds.