Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Ho can calculate a mulitple of a number?

Featured Replies

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?

Thanks,

Robert

FileMaker Version: 7

Platform: Mac OS X Panther

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

Go to Record/Request/Page [First]

Loop

If [not Mod(field, 4)]

{perform append}

End If

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

End Loop

  • Author

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,

Robert

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':

Mod(field-1,4)+1

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.

Steve

FileMaker Version: Dev 6

Platform: Windows XP

  • Author

Steve,

Thank you very much. That is exactly what I needed to be able to do and it is working great.

I appreciate it.

Robert

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.