Digital Life Posted July 24, 2006 Posted July 24, 2006 Here is a puzzle. I'm trying to convert answers like 1, 2, 3 etc into grades like A,B,C etc. I have a field called gAnswer which contains answers separated by a carriage return: 3 5 2 1 4 5 etc. If I use the middle values functions as follows: MiddleValues (ImportData::gAnswer ; 2 ; 1 ) it calculates to the 2nd value in the field ie) 5 But when I try to set another field to the converted value with this statement I get "F" every time: Case(MiddleValues ( ImportData::gAnswer ; 2 ; 1 )=1;"A"; MiddleValues ( ImportData::gAnswer ; 2 ; 1 )=2;"B"; MiddleValues ( ImportData::gAnswer ; 2 ; 1 )=3;"C"; MiddleValues ( ImportData::gAnswer ; 2 ; 1 )=4;"D"; MiddleValues ( ImportData::gAnswer ; 2 ; 1 )=5;"E"; "F") This has me confused. Any ideas?
Lee Smith Posted July 24, 2006 Posted July 24, 2006 try Case ( gAnswer = 1; "A"; gAnswer =2;"B"; gAnswer =3;"C"; gAnswer =4;"D"; gAnswer =5; "E"; "F") HTH Lee
Digital Life Posted July 24, 2006 Author Posted July 24, 2006 Thanks but that doesn't work because gAnswer is not equal to 1 or 2 or 3 or 4 or 5. gAnswer contains: 3 5 2 1 4 5 all separated by carriage returns. In other words gAnswer contains all of the answers for a test. I'm trying to extract the various values individually with the MiddleValue function and although the MiddleValue function does calculate to 5 or 2 or 1 or 4 etc. depending on the parameters, I can't seem to get it to stick when I use the Case statement?
comment Posted July 24, 2006 Posted July 24, 2006 MiddleValues() returns the value followed by a carriage return. That's why none of your tests returns true. In version 8, you can use the GetValue() function instead. BTW, it seems Choose() could be more efficient here than Case().
Recommended Posts
This topic is 6759 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now