on 2015 Jul 23 8:30 PM
Case when(c.name between 1 and 3) then 1
when (c.name between 4 and 6) then 1
when(c.name between 7 and 9) then 1
else 0
end as xyz
how to write this as a formula in crystal?
Request clarification before answering.
Hi Thanks but I realised there is some thing else
I have column which shows the data EXACTLY like this
1- Low utility
2-Low utility
3- Low utility
4- Marginal
5- Marginal
6- Marginal
7- Indicated
8- Indicated
9- Indicated
10 Acceptable
I want to group them between 1 to 3 and 4 to 6 and 7 to 9 and 10.
I am thinking of case statement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is a case statement in Crystal, but in versions before that was available, I learned to use a Switch statement. For your example, it would look something like this:
Switch(
c.name in 1 to 3, 1,
c.name in 4 to 6, 2,
c.name in 7 to 9, 3,
true, 0
)
The first part of each pair is the condition to test for and it must evaluate to true or false, the second is the value you would like to return. The "true" at the end specifies the default value.
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Chandu,
Try:
Select {c.name}
Case 1 to 3: 1
Case 4 to 6: 1
Case 7 to 9: 1
Default: 0
This particular example can also be written as:
If {c.name} in [1 to 9] then 1
or,
Select {c.name}
Case 1 to 9 : 1
default: 0
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.