Search problem - how to act when user has left search field (un)intentionally blank?
Search problem - how to act when user has left search field (un)intentionally blank?
am 23.11.2007 12:18:18 von Christoph Bouthillier
FMP 6.04, WinXP
Dear Listeners,
I have what looks like an 'easy' problem but I simply can't find the maybe 2
or 3 correct additional script steps to solve it and would appreciate any
help. Brain cell shortage I presume.
There are 4 layouts:
Menu
List
Form
Search
On Menu, List and Form there is a button "Search". It leads to the Search
layout with the following script steps:
Set Error Capture [On]
Allow User Abort [On]
Go to Layout ['Search']
Set Field ["g.search.omitted.records",""""]
Go to Field ["c.concatenated.googlish.search"]
Toggle Status Area [Hide, Lock]
Loop
Enter Find Mode [Pause]
Perform Find [Replace Found Set]
Exit Loop If ["Status(CurrentFoundCount]>0"]
Show Message ["No records have been found. Do you want to try again with
other search criteria??"]
If ("Status(CurrentM essageChoice)=2'']
Show All Records
Go to Layout ["Menu"]
Set Field ["g.search.omitted.records ",""""]
Toggle Status Area [Hide]
Perform Script [Sub-scripts, "sort_t.surname_&_t.firstname"]
Halt Script
Endlf
End Loop
If ["Status[CurrentFoundCountl> 0'']
Go to Layout ["List"]
View As [View as List]
Perform Script [Sub-scripts, " sort_t.surname_&_t.firstname"]
Toggle Status Area [Hide]
If ["g.search.omitted.records="omit""]
Show Omitted
Endlf
Endlf
On the Search layout there is only one field and only button with only one
step: "Resume". That is not the Pause/Resume script that can be chosen when
creating a proper script (that would not work I found out) but the shortcut
step chosen with Format, Button, Control, Resume Script.
As long as the user enters anything on the Search layout and presses Enter
or clicks on the Resume button, things go nicely: If nothing is found, he
can choose to give up (=> brings him back to the Menu; that is what I want)
or to continue the search. If something is found, he is shown the List, and
from there he can, if he wants to, go on to the Form. That is perfect, too.
BUT... if he fills in *nothing* on the Search layout (and I *need* to give
him the possibility to do so) and hits Enter or clicks on Resume, he is now
brought back to the *List* whereas I would like him to be brought back to
the Menu, which is much more logical/correct. So is there a way to 'tell'
the Resume button to go straight back to the Menu if the user has on purpose
or unintentionally left the search field empty?
TIA
--
Met vriendelijke groet / Mit freundlichen Gruessen / With kind regards
Christoph Bouthillier
p o s t <> oh-no-spam t e k s t o t a a l << d o t >> c o m
Forget the oh-no-spam
Re: Search problem - how to act when user has left search field (un)intentionally blank?
am 23.11.2007 16:16:29 von bill
In article <73c74$4746b706$59dc4456$10708@news.speedlinq.nl>,
"Christoph Bouthillier" wrote:
> FMP 6.04, WinXP
>
> Dear Listeners,
>
> I have what looks like an 'easy' problem but I simply can't find the maybe 2
> or 3 correct additional script steps to solve it and would appreciate any
> help. Brain cell shortage I presume.
>
> There are 4 layouts:
>
> Menu
> List
> Form
> Search
>
> On Menu, List and Form there is a button "Search". It leads to the Search
> layout with the following script steps:
>
> Set Error Capture [On]
> Allow User Abort [On]
> Go to Layout ['Search']
> Set Field ["g.search.omitted.records",""""]
> Go to Field ["c.concatenated.googlish.search"]
> Toggle Status Area [Hide, Lock]
> Loop
> Enter Find Mode [Pause]
> Perform Find [Replace Found Set]
> Exit Loop If ["Status(CurrentFoundCount]>0"]
> Show Message ["No records have been found. Do you want to try again with
> other search criteria??"]
> If ("Status(CurrentM essageChoice)=2'']
> Show All Records
> Go to Layout ["Menu"]
> Set Field ["g.search.omitted.records ",""""]
> Toggle Status Area [Hide]
> Perform Script [Sub-scripts, "sort_t.surname_&_t.firstname"]
> Halt Script
> Endlf
> End Loop
> If ["Status[CurrentFoundCountl> 0'']
> Go to Layout ["List"]
> View As [View as List]
> Perform Script [Sub-scripts, " sort_t.surname_&_t.firstname"]
> Toggle Status Area [Hide]
> If ["g.search.omitted.records="omit""]
> Show Omitted
> Endlf
> Endlf
>
> On the Search layout there is only one field and only button with only one
> step: "Resume". That is not the Pause/Resume script that can be chosen when
> creating a proper script (that would not work I found out) but the shortcut
> step chosen with Format, Button, Control, Resume Script.
>
> As long as the user enters anything on the Search layout and presses Enter
> or clicks on the Resume button, things go nicely: If nothing is found, he
> can choose to give up (=> brings him back to the Menu; that is what I want)
> or to continue the search. If something is found, he is shown the List, and
> from there he can, if he wants to, go on to the Form. That is perfect, too.
>
> BUT... if he fills in *nothing* on the Search layout (and I *need* to give
> him the possibility to do so) and hits Enter or clicks on Resume, he is now
> brought back to the *List* whereas I would like him to be brought back to
> the Menu, which is much more logical/correct. So is there a way to 'tell'
> the Resume button to go straight back to the Menu if the user has on purpose
> or unintentionally left the search field empty?
>
> TIA
You set error capture ON early in the script, but then never used a
Get(LastError) step. You can use thei step immediately after the Find
step to discover the user has not set any search criteria. The error
code for no Find criteria is 400. The code for no records match the
criteria is 401.
You can get a list of the FileMaker error codes from the Help file.
Re: Search problem - how to act when user has left search field (un)intentionally blank?
am 24.11.2007 11:17:06 von Christoph Bouthillier
--
"Bill" schreef in bericht
news:bbcollins-03742F.10162923112007@032-478-847.area7.spcsd ns.net...
> In article <73c74$4746b706$59dc4456$10708@news.speedlinq.nl>,
> "Christoph Bouthillier" wrote:
>
>> FMP 6.04, WinXP
>>
>> Dear Listeners,
>>
>> I have what looks like an 'easy' problem but I simply can't find the
>> maybe 2
>> or 3 correct additional script steps to solve it and would appreciate any
>> help. Brain cell shortage I presume.
>>
>> There are 4 layouts:
>>
>> Menu
>> List
>> Form
>> Search
>>
>> On Menu, List and Form there is a button "Search". It leads to the Search
>> layout with the following script steps:
>>
>> Set Error Capture [On]
>> Allow User Abort [On]
>> Go to Layout ['Search']
>> Set Field ["g.search.omitted.records",""""]
>> Go to Field ["c.concatenated.googlish.search"]
>> Toggle Status Area [Hide, Lock]
>> Loop
>> Enter Find Mode [Pause]
>> Perform Find [Replace Found Set]
>> Exit Loop If ["Status(CurrentFoundCount]>0"]
>> Show Message ["No records have been found. Do you want to try again
>> with
>> other search criteria??"]
>> If ("Status(CurrentM essageChoice)=2'']
>> Show All Records
>> Go to Layout ["Menu"]
>> Set Field ["g.search.omitted.records ",""""]
>> Toggle Status Area [Hide]
>> Perform Script [Sub-scripts, "sort_t.surname_&_t.firstname"]
>> Halt Script
>> Endlf
>> End Loop
>> If ["Status[CurrentFoundCountl> 0'']
>> Go to Layout ["List"]
>> View As [View as List]
>> Perform Script [Sub-scripts, " sort_t.surname_&_t.firstname"]
>> Toggle Status Area [Hide]
>> If ["g.search.omitted.records="omit""]
>> Show Omitted
>> Endlf
>> Endlf
>>
>> On the Search layout there is only one field and only button with only
>> one
>> step: "Resume". That is not the Pause/Resume script that can be chosen
>> when
>> creating a proper script (that would not work I found out) but the
>> shortcut
>> step chosen with Format, Button, Control, Resume Script.
>>
>> As long as the user enters anything on the Search layout and presses
>> Enter
>> or clicks on the Resume button, things go nicely: If nothing is found, he
>> can choose to give up (=> brings him back to the Menu; that is what I
>> want)
>> or to continue the search. If something is found, he is shown the List,
>> and
>> from there he can, if he wants to, go on to the Form. That is perfect,
>> too.
>>
>> BUT... if he fills in *nothing* on the Search layout (and I *need* to
>> give
>> him the possibility to do so) and hits Enter or clicks on Resume, he is
>> now
>> brought back to the *List* whereas I would like him to be brought back
>> to
>> the Menu, which is much more logical/correct. So is there a way to 'tell'
>> the Resume button to go straight back to the Menu if the user has on
>> purpose
>> or unintentionally left the search field empty?
>>
>> TIA
>
> You set error capture ON early in the script, but then never used a
> Get(LastError) step. You can use thei step immediately after the Find
> step to discover the user has not set any search criteria. The error
> code for no Find criteria is 400. The code for no records match the
> criteria is 401.
>
> You can get a list of the FileMaker error codes from the Help file.
Hello Bill,
Thanks for your hint, it works just fine!
I found I could leave the error capture in place but changed the old find
procedure
....
Perform Find [Replace Found Set]
Exit Loop If ["Status(CurrentFoundCount]>0"]
....
as follows:
....
Perform Find [Replace Found Set]
If ["Status( CurrentError)=400"]
Go lo Layout ["Menu"]
Halt Script
Endlf
Exit Loop If ["Status(CurrentFoundCount)>0"]
....
--
Met vriendelijke groet / Mit freundlichen Gruessen / With kind regards
Christoph Bouthillier
p o s t <> oh-no-spam t e k s t o t a a l << d o t >> c o m
Forget the oh-no-spam