Jump to content

Ho can calculate a mulitple of a number?


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

Recommended Posts

Good afternoon,

I want to be able to perform operations or or calculations only to record numbers (could be any field) that are divisible by a certain number. In this case I want to have a particular snippet of appended to and record that is a multiple of 4. How do I do this?



FileMaker Version: 7

Platform: Mac OS X Panther

Link to comment
Share on other sites

If I'm understanding you correctly, you can run a Loop with

Go to Record/Request/Page [First]


If [not Mod(field, 4)]

{perform append}

End If

Go to Record/Request/Page [Exit after last, Next]

End Loop

Link to comment
Share on other sites

I am not sure that you did understand or perhaps I did not explain well. Let me see if I can clarify using the exact example of what I am doing.

I design web sites and have some clients that have small online catalogs with merchandise that changes, some items deleted, new ones added. They do not want the expense of having an interface and database written so what I do is create a FMP database that contains all the items and have calculation fields that take the data filled in and generate a full page of HTML in the correct format.

This particular client is selling CD's and has a page of thumbnails, 4 CD's across and scrolling down as far as needed. So not only does the output need to assemble the table cells but in doing so it has to know where one row begins and ends, and the next one begins, etc... So it needs to understand sets of 4 and to know the first one in a set and the last one in that set no matter how many records and it has to do this after a sort is performed. Each record will already have the data and a serial number and will sort by name. So it always needs to know the 'sets of 4' concept. BUT I would also like to know how to make this flexible so if I create additional layouts and want the same thing to happen with sets of 4 or 5 I can still do it.

I hope this makes sense.

Thanks for listening,


Link to comment
Share on other sites

To expand on what Queue has said:

Mod(field,divisor) is the proper function for what you are trying to do. The function is called Modulo and returns the remainder when doing integer division.

Mod(field,4) results in the following:

field= 1, result =1

field= 4, result= 0

field= 5, result= 1

field= 16, result= 0

If you would prefer to have values in the range of 1 thru 4 instead of '4' being returned as '0':


field= 1, result =1

field= 4, result=4

It makes no difference how big a number 'field' is, since the result is always the remainder in integer division.


FileMaker Version: Dev 6

Platform: Windows XP

Link to comment
Share on other sites

This topic is 6493 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.