Skip 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.

Calculation Syntax

Featured Replies

I want to make this field (PO# Field) a calculation field to show results based on fields: Facility field and Equipment field. For example if Facility = "Mercy Hospital" and Equipment = "mattress", result should be: PO2222, but if Facility= "St John Hospital" and Equipment= "mattress", result should be PO4444.
Question is: what would be the syntax for the calculation on the PO# field?

 

Please see Picture attached

 

Using FMP 13 on PC

post-103927-0-98884000-1397074207_thumb.

The two examples you have given do not explain the logic by which such calculation should proceed. I suspect you really want to do a lookup here, but that's just a guess. You should explain in more detail.

Question is: what would be the syntax for the calculation on the PO# field?

 

Well, you almost spelled it out already:

Case (  Equipment = "Mattress" ;
  Case ( 
    Facility = "Mercy Hospital" ; "PO2222";
    Facility = "St John Hospital" ; "PO4444"
) )
Let me add that while this is the correct syntax for this exact requirement, you probably will want to use an Inventory table in which each record describes a piece of equipment for a facility and has a PO#; then you would be able to look up that PO via a relationship based on those two fields (preferably using equipment and facility IDs instead of names).
 
EDIT: What happened to the "New Post" alert that used to pop up while writing a reply?
  • Author

These are not two examples, they are the same example expressed twice.

However what I'm trying to do should be very simple for anyone with experience in FMP. Lets say we have 3 fields in a data base: number1 Facility field, number2 Equipment field and number3 PO# field.

The goal is to make PO# field a calculation field that will automatically populate results based on the following calculations:

If field number1 (Facility field) reads "North facility" and field number2 (Equipment field) reads "chair", then field number3 should read let's say "PO1111"

But If field number1 (Facility field) reads "South facility" and field number2 (Equipment field) reads "chair", then field number3 should read let's say "PO2222" <--- (These are just examples)

Question: what syntax in the calculation field will achieve this?

However what I'm trying to do should be very simple for anyone with experience in FMP

 

Which according to your Skill Level you should have … :smile: … but then again, it is likely not the right way to go about this.

 

Question: what syntax in the calculation field will achieve this?

 

Why don't you read the replies, e.g. in post #3?

 

Anyway, this is not a question of using the correct syntax, it's a question of the correct data structure.

 

Instead of coding any number equipment/facility combinations to produce a result, you should have a table in place where each facility/equipment combination and its associated PO is encoded as data. Then a simple lookup via a relationship will give you the desired result just by referencing the related PO field, allowing you to add any number of combinations without having to modify the lookup mechanism / calculation field.

  • Author

Thanks a lot eos, and yes, the comments you just added are exactly what I'm planning to do. Good stuff appreciate it!

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.