Page 1 of 1

Unable to get the expected result

Posted: Mon Aug 21, 2006 2:13 am
by chowmunyee
Hi all,

I encountered a very strange problem. When i write this logic
If (A.code= "C") Then "THis C" Else If (A.code= "P") Then "This is P" Else "This is CP"

but the answer for my data are all "This is CP" but this is not suppose to have because my input data is

code
---
CP
CP
P
C
P
C
CP
CP
CP
CP
P
P
P
P
C
C

Is it my logic having problem or.....? the code is character data type. I have use UpCase, trim , ' ' and <> but everything does not work. Please help

Thank you

Posted: Mon Aug 21, 2006 2:43 am
by kumar_s
If it is character trim should work.
Else If your field length is 2, then try
If (A.code= "C ") Then "THis C" Else If (A.code= "P ") Then "This is P" Else "This is CP"
Space after "C " and "P "

Posted: Mon Aug 21, 2006 4:40 am
by chowmunyee
kumar_s wrote:If it is character trim should work.
Else If your field length is 2, then try
If (A.code= "C ") Then "THis C" Else If (A.code= "P ") Then "This is P" Else "This is CP"
Space after "C " and "P " ...
Yes, It is a trim issue....thanx a lot!