Solved

WHERE clause within IF/THEN/ELSE statement - CR XI

Posted on 2010-08-23
10
262 Views
Last Modified: 2012-05-10
Currently I have a parameter {?Class1}

I have one column of data the pulls based
"If {Command.Class}={?Class1}
Then {Command.Amount}
Else 0"

What I need, is a second column that pulls
" If {?Class1} = "Fall2010"
Then {Command.Amount} WHERE {Command.Class}="Spring2009"
Else 0"

Of course, this errors with everything from WHERE to the end as "...does not appear to be part of the formula."


SIDE NOTE: Command.Class is going to be Spring2011, Spring2010, Spring2009, spring2008, Spring2007, Fall2010,Fall2010, Fall2009, Fall2008, Fall2007
What I need is Crystal to select Command.Amounts based on previous class, but Fall2009 come after Spring2010 not Spring2009 so any other suggestions on how to do this would also be appreciated.

TIA
0
Comment
Question by:stlinae
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 33506639
Where are you doing this?

mlmcc
0
 
LVL 11

Author Comment

by:stlinae
ID: 33507470
I was creating a formula for it to run in the detail section.

(BTW, the data is coming from an QuickBooks SP_Report.)
0
 
LVL 4

Expert Comment

by:msd1305
ID: 33508130
do you mean this?

If {?Class1} = "Fall2010"  and {Command.Class}="Spring2009"
Then {Command.Amount}
Else 0


actually the question is still not very clear.. are you using this is in Record selection formula or is this a formula field?
0
 
LVL 11

Expert Comment

by:tickett
ID: 33508289
msd1305's solution looks like what you want
0
 
LVL 2

Expert Comment

by:coronoahcoro
ID: 33509971
I don't think what msd1305 suggested is what stlinae want because it will be strange in this case if one record  has two class. I think what stlinae wants is when someone choose a class then CR puts the amount of that class in the first column and the rest of the columns put an amount from the previous term/season/class.

So let's say I choose Spring2010, then I want the amount from class Spring2010 to show up on the first column, the 2nd column will have the amount from Fall2010, 3rd column Spring 2009, and so on.

Please correct me if I'm wrong
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 2

Expert Comment

by:coronoahcoro
ID: 33510265
I was thinking to create a Formula  Fields with Select expression (call it ClassNum) that will look on the Class and set a number for them, like Spring2011 = 1, Fall2010 = 2. Spring2010 = 3, ...

With that I was thinking when a user choose a class, CR will put that amount class on the first column, look on the ClassNum field and create a second and the rest of the column based on previous ClassNum + 1 but of course I forgot that I don't know if CR can create a field programmatically.  
0
 
LVL 11

Author Comment

by:stlinae
ID: 33513059
coronoahcoro, you're onto the right idea. That's exactly what I want to happen. Of course I'm not sure I have any idea how to do it....

msd1305, I tried your suggestion, it brings back nothing but 0's, but thank you for the suggestion. And I'm using this in a formula field.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 33536749
I think you will have to use a subreport or a SQL expression.

Some information on SQL Expressions
http://www.experts-exchange.com/Database/Reporting_/Crystal_Reports/Q_23858441.html?cid=748#a27624600

mlmcc
0
 
LVL 11

Author Closing Comment

by:stlinae
ID: 33561886
While the excepted solution gives information on the steps needed to do this, I'm still completely lost on the HOW.
0
 
LVL 34

Expert Comment

by:James0628
ID: 33574014
FWIW ...

 I've been following this, but didn't jump in sooner because you'd gotten some suggestions and, frankly, I was being lazy and waiting to see how they panned out.  :-)

 If I follow what you're trying to do, I think you can do this with a cross-tab.  I do have a couple of questions though.

 You're trying to get a total of {Command.Amount} for each term, right?  For example, if someone asked for Fall2010, you'd have total columns like:

 Fall2010   Spring2010   Fall2009   Spring2009   Fall2008   Spring2008   <and so on>

 Assuming that I'm correct about that, are those grand totals for the entire report, or for some group on the report?

 If someone asks for Fall2009, for example, what happens to the records for terms after that (Spring2010, etc.)?  Do you have a record selection formula that will filter out those records or do they get included somewhere in your counts?

 James
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now