Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5169 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all,

i'm still fine-tuning my baby database. so, i wrote a script to search for babies with criteria set by the users, but it does not work properly. In a simple search like searching for babies with certain language and age criteria, the search result does not include all that meet these criteria. For example, for searching babies who hear 80% English within the range of 4 - 6 months, the search is omitting some baby records that do not follow any patterns.

Please see my attached screenshot of my script.

Thanks!

Picture_1.png

Posted

I'm not sure what you mean "records that do not follow any patterns".

I'll bet if you enter the same Find criteria manually (not in a script) it will return the same. You can pause the script right before executing the Find to see what it has entered as the search criteria.

Posted

You don't need to have global variables UNLESS you need the values to persist after the script has run.

You seem to be finding records, then omitting some based on criteria. Try just performing the find, then looping through the fund set and omitting the records manually instead of doing it all in the find itself.

If that still doesn't work then it's probably a data structure issue.

Posted

... maybe double-check that all the fields you're setting with "numeric" criteria are indeed "Number" fields. I've gotten weird results from having my field type wrong.

Next, in steps where your calculation assembles a criteria string, such as the "Babies/AgeinDays" and "Babies/gestationWeeks" fields, try using an "Insert Calculated Result" step instead of "Set Field." That's tripped me up many times, too.

Finally, using the "%" character in the "Languages/% Lang" field diverges from FM's naming recommendations, so referencing it in calculations requires it be "escaped." I doubt that's causing this problem, but it could cause another one, elsewhere.

Hope it helps!

Posted

Hi lawaid,

Thanks for the helpful tips.. I tried to use "insert calculated result" instead of "set field" but it is getting me irrelevant data. Can I use that along with set field? For example, I have something like this

Enter Find Mode[]

Insert Calculated Result[select; babies:ageinDays; $AgeFromInDays&"..."&"$AgeToInDays]

Set Field[Languagues::Lang; $Lang]

Set Field[Languagues::LangPercent; $percentLang]

It seems like it's only searching for records which meet the last two criteria but the first search criteria does not seem at work..

Any ideas? Thanks!

Posted

Please forgive me for not responding sooner. I'm hoping you got this resolved, and I'm just late.

There's a tiny syntax error in the calculation, having one-too-many double-quotes ("). Should probably be ...

$AgeFromInDays & "..." & $AgeToInDays]

FileMaker usually catches these and doesn't let us save a calc with syntax problems. Maybe you have it right in the database but mistyped it here.

I'll try to check back sooner than last time!

Posted (edited)

Hi lawaid,

Thank you for being so kind!

i tried having three dots in between the "&"s in my calculation, but the search still didn't work properly.

In fact it seemed that "insert calculated field" function does not work at all.. when i used that, the search is all over the place. so I changed back to the "set field" function. but the mystery still exist: the search only finds a set of the results that meet the criteria, and the missing records do not follow any pattern. what is going on??

let me know if you have any ideas. thanks a lot!

Edited by Guest

This topic is 5169 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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