on 2014 Mar 19 2:49 PM
Hi Frzz,
I have below requirement in Calculated column with CASE statement. Could some one help me how to achieve this with case statement.
String = 0Hello
01Hello
012Hello
0123Hello
If 1st Character of the string is '0' then - 0Hello
1st 2 characters of the String is '01' - 22Hello
1st 3 characters of the String is '01' - 333Hello
1st 4 characters of the String is '01' - 4444Hello
Thank you.
Best Regards,
Krishna.
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Krishna G,
For Calculation views that are created as graphical it works its exactly the same. So you can not use Case in it..
For Script based Calc view you can not use Case in Procedural script but cal be used in a select statement embedded in it.
For more detail check Henrique's reply in the post below
Hi Krishna,
If i have to use multiple IF statements like above case. how can i write multiple IF statements??
Can i write below??
IF(midstr("STRING1",1,1),'0',"STRING1")
IF(midstr("STRING1",1,2),'01','22'+rightstr("STRING1",6))
IF(midstr("STRING1",1,3),'012','333'+rightstr("STRING1",6))
IF(midstr("STRING1",1,4),'0123','4444'+rightstr("STRING1",6))
Best Regards,
Krishna.
Yes, you can do in multiple ways. ( As shown above)
1) Using IF with MATCH
2) Using Case with MATCH
and even using midstr
If I understood your requirement correctly, then this should be the correct way of representing as shown below:
IF(midstr("STRING1",3,1),'333Hello',"STRING1")
Regards,
Krishna Tangudu
Hi Krishna,
If i want to implement IF ELSE kind of statements in Calculated column, how can i achieve it. In your last reply you mentioned how to write multiple IF statements.
Scenario:
IF ( 1st Character <> 0 ) -- > Yes --> Do some calculation
---> NO ---> < IF (Numeric ) --> YES--> Convert to String->Lpad->IFs(con)
--> NO --> Lpad-->IFs(condition)
Best Regards,
Krishna.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 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.