Page 1 of 1

Search Widget FM9

PostPosted: Mon Oct 05, 2009 3:38 am
by Nigel_P_Smith
Hi,
I have the solution working really well with just one problem.
When I first open my database, I cannot get the search to work. I enter a search term, then click the magnifying glass and nothing happens. Checking the script, it appears to think there is nothing in the search box.

I have to click out of the box, or minimise and then maximise my window. Then the system works fine.

Any ideas as to what I am doing wrong?

Thanks

PostPosted: Mon Oct 05, 2009 7:09 am
by John Sindelar
It sounds like you're not committing the edit to the search field before the script does its work. But the search script itself does this so I'm not sure why this might be happening.

Does it behave this way if you copy and paste the search widget right from the fmSearchResults example file? That has a couple script triggers on it and perhaps those got mixed up if you edited the widget.

Let me know if pasting in a fresh one helps, and if it doesn't, let me know which version of FileMaker you're using.

Best,

John

PostPosted: Mon Oct 05, 2009 8:06 am
by Nigel_P_Smith
John,
A bit more info...

Looking at the script in script debugger, SR_SearchString is empty right from the beginning and so the script exits as it does not think I have entered anything. I stopped the script at the "Set Error Capture [On] step in script debugger.

If I then click out of the widget and then back into it, then press the widget and run the script again, the variable SR_SearchString has my info in it.

I'm on FM 9.03

Nigel

PostPosted: Mon Oct 05, 2009 8:16 am
by John Sindelar
It is OK for your field not to be committed at the Set Error Capture on step. The commit step further on (after the comment "Commit first...") takes care of this.

When you watch it in the debugger, where is the script exiting?

PostPosted: Mon Oct 05, 2009 8:22 am
by Nigel_P_Smith
Hi,

Ive sussed it by adding a Commit in your search script to just after the Set Error Capture [On] as the script was checking for an entry and I was not getting to the Commit in the If statement which would just Exit Script anyway.

Works fine now. Thanks