Search selected OR from all records
Search selected OR from all records
am 12.01.2008 22:51:14 von Jimmy
Hi,
In the DB, there are 3 fields :
Object (text)
Color (yellow, blue, red)
Color_Selected : pop-up menu displays values from Color list
then I create the Script "Color_Find":
Go to Layout ["Home"]
Enter Find Mode []
Insert Calculated Result [Select; Color; Color_Selected]
Perform Find []
If [Get(foundCount =0)]
...
else
...
End If
First, I search for some objects then execute "Color_Find",
the problem that "Color_Find" gives always the results from all
records in the DB and not from my first result !
There must be a mistake somewhere !!!!!
Thank you for showing the error.
Re: Search selected OR from all records
am 12.01.2008 23:41:37 von Helpful Harry
In article <47893652$1_1@news.bluewin.ch>, "Jimmy"
wrote:
> Hi,
>
> In the DB, there are 3 fields :
>
> Object (text)
> Color (yellow, blue, red)
> Color_Selected : pop-up menu displays values from Color list
>
> then I create the Script "Color_Find":
>
> Go to Layout ["Home"]
> Enter Find Mode []
> Insert Calculated Result [Select; Color; Color_Selected]
> Perform Find []
> If [Get(foundCount =0)]
> ...
> else
> ...
> End If
>
> First, I search for some objects then execute "Color_Find",
> the problem that "Color_Find" gives always the results from all
> records in the DB and not from my first result !
>
> There must be a mistake somewhere !!!!!
>
>
> Thank you for showing the error.
The Find command (whether manually performed or via a Script) is ALWAYS
performed on ALL the records in the Table.
If you want to restrict the Find to the records already in a Found set
/ subset then you need to use the Modify Last Find command - again,
either manually via the Records menu or the script command. This
command retrieves the previous Find Requests ready for you to change or
add to.
For your script you would need something like:
Go To Layout ["Home"]
Modify Last Find
Insert Calculated Result [Select; Color; Color_Selected]
Perform Find []
If ...
There is one thing to note here though. If you have one script that
performs a Find, then returns to the user who then runs a second
script, then the Modify Last Find may not retrieve the Find Requests
you're expecting - the user may well have performed another Find
inbetween running the scripts.
Notes:
1. There's also a mistake in your script above, but it may just be
a typo when transferring to the newsgroups message - the "If"
statement has the "=0" inside the rounded parentheses when it
should be outside them.
ie.
If [Get(FoundCount) = 0]
2. You don't need to use the Insert Calculated Result command.
You could use the Set Field command instead.
eg.
Set Field [Color; Color_Selected]
I don't know if there's any speed penalty one way or the other,
and it doesn't really matter with only the one command.
Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)
Re: Search selected OR from all records
am 13.01.2008 02:49:15 von Howard Schlossberg
Jimmy wrote:
> Hi,
>
> In the DB, there are 3 fields :
>
> Object (text)
> Color (yellow, blue, red)
> Color_Selected : pop-up menu displays values from Color list
>
> then I create the Script "Color_Find":
>
> Go to Layout ["Home"]
> Enter Find Mode []
> Insert Calculated Result [Select; Color; Color_Selected]
> Perform Find []
You list Color_Selected as a field, but it isn't clear what type of
field it or the Color field is.
If it is a global text field and the Color field is also a text field,
then your script should work.
If Color_Selected is not a global field, then it has no value in it when
you are in find mode, so there is nothing to use as your find criteria.
If what you are trying to do is select a color (as text) in one field
and search a container field, then this isn't going to do it. Let us
know and we can help with this.
If you are trying to take whatever color was set to Color_Selected in
Browse mode, and that field is a regular (non-global) field, and you are
trying to find all the Colors that match, then you will need to grab the
value of Color_Selected into a script variable before entering Find mode
and then use that variable to set the Color field while in Find mode.
If you can explain a little more what you are trying to do, perhaps we
can be a little more specific in helping you through the issue.
Howard
[solved] : Search selected.. Thank you
am 13.01.2008 12:55:09 von Jimmy
Thank you very much "Helpful Harry".
With your help, my problem is solved
"Helpful Harry" wrote :
> The Find command (whether manually performed or via a Script) is ALWAYS
> performed on ALL the records in the Table.
>
> For your script you would need something like:
>
> Go To Layout ["Home"]
> Modify Last Find
> Insert Calculated Result [Select; Color; Color_Selected]
> Perform Find []
> If ...
>
> Helpful Harry
> Hopefully helping harassed humans happily handle handiwork hardships ;o)
Re: Search selected ... thanks
am 13.01.2008 12:58:02 von Jimmy
Thanks for your help.
I use the "Helpful Harry" 's solution. It's ok.
"Howard Schlossberg" wrote >
> If Color_Selected is not a global field, then it has no value in it when
> you are in find mode, so there is nothing to use as your find criteria.
>
> If what you are trying to do is select a color (as text) in one field and
> search a container field, then this isn't going to do it. Let us know and
> we can help with this.
>
> If you are trying to take whatever color was set to Color_Selected in
> Browse mode, and that field is a regular (non-global) field, and you are
> trying to find all the Colors that match, then you will need to grab the
> value of Color_Selected into a script variable before entering Find mode
> and then use that variable to set the Color field while in Find mode.
>
> If you can explain a little more what you are trying to do, perhaps we can
> be a little more specific in helping you through the issue.
>
> Howard