Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6759 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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?

Posted

try

Case ( gAnswer = 1; "A";

gAnswer =2;"B";

gAnswer =3;"C";

gAnswer =4;"D";

gAnswer =5; "E";

"F")

HTH

Lee

Posted

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?

Posted

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().

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.