8 Replies Latest reply on Nov 2, 2009 8:56 AM by raybaudi

# Calculations, FM Pro 9

### Title

Calculations, FM Pro 9

### Post

I am using FM 9 (shared over a network) on a MAC (OS 10) and am having trouble creating a calculation, which seems like it should be fairly simple.  I am a beginner to intermediate FM user, so the more detailed the replies ther better.  :)

I have 3 fields (AM, PM, LPM) that collect data entered as a number or as a letter.  I need to assign the letter the value of .5 ( i.e. T = .5 ).  I need to summarize the data entered as "T" in a fourth field (Travel).

Basically, if  AM, PM, and LPM each have a "T" entered, I need Travel to display 1.5...  if only AM is "T", then Travel = .5...  if AM and PM both have "T" entered, then Travel = 1...  and so on.

Travel should only read "T" in the fields and ignore any other entry in the fields... as the other letters will need to relate similarly to a different field.

THANKS!!

• ###### 1. Re: Calculations, FM Pro 9

Hi

this calculation is easy to adapt for furter letters ( just add rows ) :

Evaluate ( Substitute ( List ( AM ; PM ; LPM )
; [ "T" ; ,5 ]
// add similar rows for other letters

; [ ¶ ; "+" ]
) )

• ###### 2. Re: Calculations, FM Pro 9

Thank you so much!  It ALMOST works perfectly... sometimes I have a number 091, for example, in the AM, PM, or LPM field, and it is adding that number to the "T" value (.5) in the Travel field.  I need the Travel field to ignore any value that is NOT  a "T"...  is it possible to do that?

Melinda

• ###### 3. Re: Calculations, FM Pro 9
PatternCount ( AM & PM & LPM ; "T" ) * .5
• ###### 4. Re: Calculations, FM Pro 9
this appears to be the solution!!  thank you so much for your help!!
• ###### 5. Re: Calculations, FM Pro 9

I have another question related to this thread...

I need to find all records in which the AM, PM, and/or LPM fields = a particular number -- each service we provide is classified by a specific number, used only for that particular service, and we track (by consultant name) when the service was provided (AM, PM, LPM).  Basically, I want be able to enter the particular number into a field and if it is found in any, some, or all of the AM, PM, LPM fields, I want it to find them so that I can export that information into a report...

Happy to clarify if this doesn't make sense, but I am stumped!

Thanks,

Melinda

• ###### 6. Re: Calculations, FM Pro 9

Hi Melinda

you'll need to create a new field and a new script...

1) new field gSearch ( text field with global storage )

2) new script "Search for partcular number", something like:

Set Error capture [ On ]
Go to layout [ YourDefinitedSearchLayout ]
Enter Find Mode [ ]
Set Field [ AM ; gSearch ]
New Record/Request
Set Field [ PM ; gSearch ]
New Record/Request
Set Field [ LPM ; gSearch ]
Perform Find [ ]
If [ not Get ( FoundCount ) ]
Show custom message [ "No record found" ]
End If

• ###### 7. Re: Calculations, FM Pro 9

Okay, I think I am missing something...  the find is finding ALL records - I have three test records, only two include the number I am searching for, but when I enter the number and run the script, it brings up all three records...

I created the global field gSearch, actually named the field "gSearch"

Here is the script I am running:

"Set Error capture [ On ]
Go to layout [ Original Layout ]
Enter Find Mode [ restore;pause]
Set Field [ AM Service ; gSearch ]
New Record/Request
Set Field [ PM Service ; gSearch ]
New Record/Request
Set Field [ LPM Service ; gSearch ]
Perform Find [ restore]
If [ not Get ( FoundCount ) ]

End If"

I REALLY, REALLY appreciate your help!!

Melinda

• ###### 8. Re: Calculations, FM Pro 9

Melinda wrote:

Set Error capture [ On ]
Go to layout [ Original Layout ]
Enter Find Mode [ restore;pause] <-- check here: there must be nothing inside those square brackets
Set Field [ AM Service ; gSearch ]
New Record/Request
Set Field [ PM Service ; gSearch ]
New Record/Request
Set Field [ LPM Service ; gSearch ]
Perform Find [ restore] <-- check here: there must be nothing inside those square brackets

If [ not Get ( FoundCount ) ]

End If

I REALLY, REALLY appreciate your help!!

Melinda