acro Posted April 9, 2014 Posted April 9, 2014 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
comment Posted April 9, 2014 Posted April 9, 2014 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. 1
eos Posted April 9, 2014 Posted April 9, 2014 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?
acro Posted April 9, 2014 Author Posted April 9, 2014 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?
eos Posted April 9, 2014 Posted April 9, 2014 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 … … 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.
acro Posted April 9, 2014 Author Posted April 9, 2014 Thanks a lot eos, and yes, the comments you just added are exactly what I'm planning to do. Good stuff appreciate it!
Recommended Posts
This topic is 4148 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 accountSign in
Already have an account? Sign in here.
Sign In Now