September 16, 201015 yr 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!
September 17, 201015 yr 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.
September 17, 201015 yr 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.
September 17, 201015 yr ... 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!
September 20, 201015 yr Author 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!
September 27, 201015 yr 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!
September 27, 201015 yr Author 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 September 27, 201015 yr by Guest
Create an account or sign in to comment