| Author |
Message |
viperbyte
Newbie
Joined: 13 May 2013
Location: United States
Online Status: Offline
Posts: 38
|

Topic: Tricky Field Problem Posted: 13 May 2013 at 6:39am |
|
Hello everyone. This is my first post. I hope to be able to contribute in the future but for now I'm asking for help. With CR8.5 I need to be able to allow a user to enter a Quarter when prompted, such as 1, 2, 3, or 4. Our tables don't store quarters. We store months as integers which we call periods. A valid period could be any integer value from one to twelve. I know how to create a parameter for grabbing the quarter value but how do get the report to just show me the periods (months) that pertain to the desired quarter? Can someone super please give me a hand with this?
|
IP Logged |
|
|
|
joeg1962
Newbie
Joined: 01 Mar 2013
Location: United States
Online Status: Offline
Posts: 35
|

Posted: 13 May 2013 at 7:13am |
|
Assuming you have the quarter number stored to a variable, in my case _qtr you could then create a field for the month_begin as follows:
Select {@_qtr} Case 1 : 1 Case 2 : 4 Case 3 : 7 Case 4 : 10
Then do something similar for a variable month_end
|
IP Logged |
|
viperbyte
Newbie
Joined: 13 May 2013
Location: United States
Online Status: Offline
Posts: 38
|

Posted: 13 May 2013 at 7:51am |
|
I'm missing something. I fail to see how the correct records are going to show up. If quarter 2 is enterd then that would mean that i need only records with value 4,5 or 6 in the period column. How do I get his bit of code to hookup with either SQL or a forumula? I'm a newbie sorry for my ingnorance.
|
IP Logged |
|
bwsanders
Senior Member
Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
|

Posted: 14 May 2013 at 2:30am |
|
couldn't you create groups for the months and create quarters?
i mean like group 1 could have a formula which says something like {field} in ["1", "2", "3"] so that would be the first quarter. you'd have to do that for each quarter and then set the group to suppress unless it's chosen by the end user which i'm assuming you are going to pass through as an additional formula.
hope that helps.
|
IP Logged |
|
Gurbs
Senior Member
Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
|

Posted: 14 May 2013 at 2:42am |
|
I think I would do it slightly different.
Start by making you parameter where users can choose which quarter they want to use. Set this as a number parameter. Name this Quarter
I would then create a formula like
If {table.month} = 1 then 1 else
if {table.month} = 2 then 1 else
if {table.month} = 3 then 1 else
if {table.month} = 4 then 2 else
if {table.month} = 5 then 2 else
etc.
Name this Quarter as well. (formula's will start with a @, parameters with ?, so that won't give a problem)
If you then group on this formula, you will get 4 groups. One for every quarter.
In your section expert, conditionally suppress your group with the following formula
{@Quarter} <> {?Quarter}
This will suppress your group when it is different from the value you enter in your parameter.
|
IP Logged |
|
bwsanders
Senior Member
Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
|

Posted: 14 May 2013 at 2:45am |
|
yeah Gurbs has got it. i was thinking of a case statement as well.
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|

Posted: 14 May 2013 at 3:54am |
from a data select perspective I would alter this a bit unless you do want to pull all the data and then suppress it.
create the parameter 'Quarter' set to number data type with a min of 1 and a max of 4 to prevent entry errors.
I dont know if your quarters a FY or a calendar year so this sample uses calendar year.
in your select expert use
({?Quarter}=1 and {table.month} in 1 to 3)
or
({?Quarter}=2 and {table.month} in 4 to 6)
or
({?Quarter}=3 and {table.month} in 7 to 9)
or
({?Quarter}=4 and {table.month} in 10 to 12)
This does not account for the year so you may also need to add in a criteria for that based on your desired data.
|
IP Logged |
|
viperbyte
Newbie
Joined: 13 May 2013
Location: United States
Online Status: Offline
Posts: 38
|

Posted: 16 May 2013 at 3:12am |
|
Thanks for the replies everyone. I really appreciate the help. I haven't replied earlier because at work I'm swamped and since I get up at 5:00am by the time I get home at 7:30pm I just want to go to sleep. I'm now going to try to incorporate the suggestions from this post. I'll let you know how it goes. Thanks again.
|
IP Logged |
|
viperbyte
Newbie
Joined: 13 May 2013
Location: United States
Online Status: Offline
Posts: 38
|

Posted: 17 May 2013 at 3:45am |
|
Thanks everyone and a special thanks to Gurbs. With a little help from you guys I hope to make a good enough impression to pass my 90 day probation.
|
IP Logged |
|
viperbyte
Newbie
Joined: 13 May 2013
Location: United States
Online Status: Offline
Posts: 38
|

Posted: 22 May 2013 at 10:43am |
Gurbs when I use your suggestion I get an error that says "String expected here" and the error is pointing to the paramerter {?Quarter} in the following snippet that I put in the format section of the group with also checking the supress section:
|
IP Logged |
|
|
|