# Calculation Question

## Recommended Posts

Hi Guys,

I have a Script running a calculation for a Find.

The table is in essence as follows

 Item Percentage Find Field

My Script/Calculation is as follows:

Quote

Enter Find Mode [Pause: Off]

Set Field [Percentage ; Percentage ≥ Find Field ]

Set Error Capture [On]

Perform Find [ ]

Sort Records [Restore ; With dialog: Off]

Go to Record/Request/Page [First]

I have an identical Script with text relating to the item. This works perfectly.

For some reason the calculated field isn't.

The input for this Find Field is entered as a decimal number (the setting of the the field turn it into a percentage). So if I am looking to find ≥ 10% I would enter .1 into the Find Field.

When running the script, I am getting blank, with no matching records - despite the fact I know there are records higher than 10%.

Am I doing something obvious wrong? I've also tried Find Field ≥ Percentage, but getting the same result - with no records matched.

Thanks!

N

##### Share on other sites

Why is "find field" a field in that table?  Is it a global field?

##### Share on other sites

If Find Field is a global field*, and you are trying to find records where percentage is greater than or equal to the value entered in Find Field, then you need to do:

```Enter Find Mode []
Set Field [ YourTable::Percentage ; "≥" & SomeTable::Find Field ]
...```

Otherwise I have no clue what you're trying to do here.

`Percentage ≥ Find Field`

is a Boolean expression; it will return a result of either 1 (true) or 0 (false).

---
(*) Only global fields have values in Find mode.

##### Share on other sites

Thank you. As always the advice is spot on.

I need to learn scripting better! It was the fact that I didn't have the "" and the &.... so it worked in my mind.

Also, correct on Global Field. I created the Field as a Global Field, for the purpose of searching only.

Thanks as always

##### Share on other sites

You don't need to create global fields in that table, you can use a dedicated table just for global fields and keep your schema 'clean'.  Plus if you are capturing the user's input for what to search on, you can use variables

##### Share on other sites

That's true and makes a lot of sense. Thanks!

##### Share on other sites

You also may want to adopt a naming convention for your fields so that you can tell whether they are global or not.  That makes it easier to read your code and interpret it.  Plus your future self will thank you for it.

## Create an account

Register a new account

• ### Similar Content

• By Spidey
Hi,
I have two table: Invoice and Customer.  I like to have the total of all the invoice for a customer between certain date in the Customer portal that show all the customers, but I got a error when I try to debug..
ExecuteSQL("SELECT SUM(I.TotalAmount) FROM Invoice I JOIN Customer C ON I._kf_CustomerID = C.__kp_CustomerID WHERE date(I.InvoiceDate) between date(C.SearchFromDate ) and   date(C.SearchToDate )" ; "" ; "" )
I have an error and couldn't figure it out.  Thanks...
KC

• I have a client that has been using a send email script step  that brings up the outlook email client on the desktop.  This as worked for years no problem.  It has stopped work on 3 of 35 computers within the last two weeks.  I talked with there IT personal and they have assured me that no updates have happened.  The actual error is -
Microsoft Office Outlook
Either there is no default mail client or the current mail client cannot
fulfill the messaging request.  Please run Microsoft Outlook and set it as
the default mail client.

I have double checked with system default  and Outlook's settings.  Both are set to default.
Any suggestions are welcome.

• I have an excel sheet that controls bills of ladings for a forestry company.  In the example you can see that there is lots going on with this Bill.  It has a payperiod, mill, truck that delivered it, etc.
I would like setup a database to monitor this.  The fields CT1, CT2, Skid1, Skid2. PROC1, PROC2 are all contractor numbers.  There are 6 contactors.  The percentages in each line are the amount of the volume they performed  In the third line there is a value in CT1 only...they get 100% of the volume.  I can figure out most of this, but am stumped on how I can monitor when a contractor does multiple jobs..ie in line one, contractor 5, cuts and skids.  All 6 contractors could be involved in one BOL. Each one of these jobs, cutting, skidding and processing each has their own respective rate of pay as well.   I think i need a way to break down each line so that I can produce pay summaries for each of the contractors.  I had started this years ago, and thought I asked in a forum, but can't remember where.  Nonetheless, they stopped using multiple contractors per load...Now they have returned, so I am back at it.  So if this is a repost from years ago I apologize.
tbcomputerguy

• I am using Filemaker Server 18 on Windows Server 2012 R2
Been using it for years with no issues
Currently when I log in to the console it is very sluggish.
When I get to the Dashboard it shows No databases, then it auto refreshes and the database list appears.
Within 15 seconds of scrolling the database list to open files the screen refreshes. This situations is happening over and over in a loop.
Any Thoughts on what is causing this issue?

• I get an error 3 when using a script to Export Records via WebDirect. Using FileMaker Server 18 and have tried both Safari and Chrome both with same results. I have tried using the temporary path, desktop path, and documents path. I have tried using with the automatically open and not. I have tried writing a tab delimited and comma delimited file. Does anyone have ideas I haven't yet tried?
• ### Who Viewed the Topic

10 members have viewed this topic:
besfe  Steve Martino  bcooney  kurucay2000  comment  Wim Decorte  Neil Scrivener  stefangs  Ocean West  NLR

×
×
• Create New...