5 Replies Latest reply on Feb 28, 2012 4:48 AM by comment

# Simple if statement

Hi,

I am trying to script a simple if else loop to generate a fee to be paid by customers.

It should do the following:

They are in group 1, 2, 3, 4 etc depending on this they should pay a fee of 50, 60, 70, 80 and so on.

Ho do I write an if else loop that would do this, I am really new to this and I can only come up with this:

fee = If ( group = "1"; 50; 60 )

What I really want is to be able to use a table

Group
Fee

1

50
260
370
480
590
6100
7110
8120
9130
10140
11150
12160
13170
14180
15190
16200

I have created a value list with the group number (this list is very very long). Depending on the group the fee field should just automatically be filled in with the corresponding fee rate.

Can you think of a better way of doing this, because creating a script with if 1 then 50 uf 2 then 60 for a list of hundreds of rows will be annoying.

Thanks

/tomas

• ###### 1. Re: Simple if statement

Tomas,

It appears that the group fee is defined by the following expression:

fee = 40 + ( group x 10 )

Can you verify?

Lee.

=================

Binary Assist

220 Gaines Oak Way

Suwanee, GA 30024

Voice: (678) 313-5604

Internet: lhoong@binaryassist.com

Website: www.binaryassist.com

FileMaker Certified Developer

• ###### 2. Re: Simple if statement

Unfortunately it is not as easy. It is a non-linear fee structure which changes every year (potentially month) depending on currency value etc.

• ###### 3. Re: Simple if statement

tomas wrote:

It is a non-linear fee structure which changes every year (potentially month)

You should not be using a calculation for this, because  fees change. Instead, define a table of Groups and lookup the fee from there using a relationship based on matching group.

• ###### 4. Re: Simple if statement

That worked, and I agree it is a much better way than using a script. If anyone else reads this is a good reference for lookup: http://fmhelp.filemaker.com/fmphelp_10/en/html/func_ref3.33.16.html

• ###### 5. Re: Simple if statement

Actually, I meant:

http://fmhelp.filemaker.com/fmphelp_10/en/html/relational.11.22.html#1029032

The Lookup() function can work too, provided you are not using it in an unstored calculation field.