4 Replies Latest reply on Jun 20, 2012 8:36 PM by PalmDBS

# Using Get or Logical Functions For If/Then

Evening,

I'm trying to create a calculation that basically says this: if the field "group" contains/says "monkey", then the field name "shortened group name" would contain/say/show "M", if the field "group" contains/says "dog", then the field name "shortened group name" would contain/say/show "D", if the field "group" contains/says "tiger", then the field name "shortened group name" would contain/sayshow "T", and if the field "group" contains/says "human", then the field name "shortened group name" would contain/sayshow "H".

Essentially, I'm trying to say that if a condition/field is met, than "A", if the condition is not met, then look at the condition/field again and if the next condition is met, then "B" and so on.

I hope I am making sense.

I am using FP 8.5.

• ###### 1. Re: Using Get or Logical Functions For If/Then

Have a look at the Case statement:

http://www.filemaker.com/11help/html/func_ref3.33.2.html#1027634

I believe that will get you the desired result.

Cheers,

Paul.

• ###### 2. Re: Using Get or Logical Functions For If/Then

Another option is to add a table of Groups, with fields for FullName and ShortName, and get the short name from there via a relationship matching on full name. This way you avoid storing your data in a calculation formula.

• ###### 3. Re: Using Get or Logical Functions For If/Then

If I read your logic correctly, you want to show the first letter of your 'Group' field, converted to uppercase?

If so, you don't need to use a 'Case' or 'If' function - just try the following formula:

Shortened Group Name = Upper(Left(Group;1))

(This picks the first letter of the contents of the field 'Group' and then converts it to uppercase.)

This will only work if, in every case, you require the initial letter of the 'Group' field in uppercase.

If you need a different initial letter in one or more cases, then you will need to use either of the other two suggestions that you have received so far.

Best wishes - Alan Stirling

• ###### 4. Re: Using Get or Logical Functions For If/Then

This the definitely the best route if the Group only contains 1 item.  If there are multiple group names, and you want, as the OP states, to check if group "contains/states" a value, use a case statement like this

Case (

Position(Table::Group;"Monkey";1;1); "M";

Position(Table::Group;"Dog";1;1); "D";

Position(Table::Group;"Tiger";1;1); "T";

Position(Table::Group;"Human";1;1); "H";

"")