dbTalk Databases Forums  

Collecting find criteria (newbie question)

comp.databases.filemaker comp.databases.filemaker


Discuss Collecting find criteria (newbie question) in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Carla
 
Posts: n/a

Default Collecting find criteria (newbie question) - 11-18-2005 , 05:43 AM






Can anyone suggest a simple and elegant method for this? I need to do
a Find, based on the user's selection of certain criteria. This can be
any combination of 4 different years, i.e. 2005, 2004, 2003, 2002. I
think I'm OK with actually scripting the Find (with extending the found
set, etc.), but I'm struggling with actually collecting the criteria.
I think I need a separate layout on which the user selects the years
(but how?), and then a method of using these criteria in a find.

Maybe I'm making this unnecessarily complex?

Any help would be greatly appreciated!

Carla Sloan


Reply With Quote
  #2  
Old   
ursus.kirk
 
Posts: n/a

Default Re: Collecting find criteria (newbie question) - 11-18-2005 , 06:57 AM






I don't think you are making it too complex.

create a globalfield
create a value list <YEARS ; 2005 ; 2006 ; 2007 >
Put the global field on a layout
connect the field to the value list
Make the field selection-boxes

Make a button on the layout set to continue script

Make a script
goto search-layout
goto find <halt script>
perform find
goto layout you want

so now the user start the search scirp (by a button)
goes to the search-layout
enters the year and click the continue button
the search is performed.

Be aware that these are just barebones. No error trapping etc build-in, but
it should get you on the right path

Ursus




"Carla" <carla_sloan (AT) yahoo (DOT) co.uk> schreef in bericht
news:1132314187.644293.3320 (AT) f14g2000cwb (DOT) googlegroups.com...
Quote:
Can anyone suggest a simple and elegant method for this? I need to do
a Find, based on the user's selection of certain criteria. This can be
any combination of 4 different years, i.e. 2005, 2004, 2003, 2002. I
think I'm OK with actually scripting the Find (with extending the found
set, etc.), but I'm struggling with actually collecting the criteria.
I think I need a separate layout on which the user selects the years
(but how?), and then a method of using these criteria in a find.

Maybe I'm making this unnecessarily complex?

Any help would be greatly appreciated!

Carla Sloan




Reply With Quote
  #3  
Old   
Carla
 
Posts: n/a

Default Re: Collecting find criteria (newbie question) - 11-18-2005 , 11:52 AM



Ursus,

Thanks very much for this, which certainly has set me on the right
path. However, I still have a problem. The script works fine if only
one year is selected. But if multiple years are selected, how do I use
the contents of the global field in the Find? With multiple years
selected, the field contains a line for each of the selected years.
Obviously I can't just put the entire contents of that field into my
search layout, so I guess I need to separate out the years, and do a
separate Find on each one, extending the foun set each time. How do I
separate out those years?

(Sorry if this is obvious stuff.)

Carla.


ursus.kirk wrote:
Quote:
I don't think you are making it too complex.

create a globalfield
create a value list <YEARS ; 2005 ; 2006 ; 2007
Put the global field on a layout
connect the field to the value list
Make the field selection-boxes

Make a button on the layout set to continue script

Make a script
goto search-layout
goto find <halt script
perform find
goto layout you want

so now the user start the search scirp (by a button)
goes to the search-layout
enters the year and click the continue button
the search is performed.

Be aware that these are just barebones. No error trapping etc build-in, but
it should get you on the right path

Ursus




"Carla" <carla_sloan (AT) yahoo (DOT) co.uk> schreef in bericht
news:1132314187.644293.3320 (AT) f14g2000cwb (DOT) googlegroups.com...
Can anyone suggest a simple and elegant method for this? I need to do
a Find, based on the user's selection of certain criteria. This can be
any combination of 4 different years, i.e. 2005, 2004, 2003, 2002. I
think I'm OK with actually scripting the Find (with extending the found
set, etc.), but I'm struggling with actually collecting the criteria.
I think I need a separate layout on which the user selects the years
(but how?), and then a method of using these criteria in a find.

Maybe I'm making this unnecessarily complex?

Any help would be greatly appreciated!

Carla Sloan



Reply With Quote
  #4  
Old   
Helpful Harry
 
Posts: n/a

Default Re: Collecting find criteria (newbie question) - 11-18-2005 , 03:54 PM



In article <1132336352.702215.98600 (AT) z14g2000cwz (DOT) googlegroups.com>,
"Carla" <carla_sloan (AT) yahoo (DOT) co.uk> wrote:

Quote:
Ursus,

Thanks very much for this, which certainly has set me on the right
path. However, I still have a problem. The script works fine if only
one year is selected. But if multiple years are selected, how do I use
the contents of the global field in the Find? With multiple years
selected, the field contains a line for each of the selected years.
Obviously I can't just put the entire contents of that field into my
search layout, so I guess I need to separate out the years, and do a
separate Find on each one, extending the foun set each time. How do I
separate out those years?

(Sorry if this is obvious stuff.)
That depends on whether you want to find records between two years or
just the selcted years.

For between two years, you can use two Global fields: StartYear and
EndYear. Then in the script you can:

Enter Find Mode []
Insert Calculated Result [Year, StartYear & "..." & EndYear]
Perform Find []

Assuming Year is a number field, if you're trying to find on a Date
field then it gets a little more complicated and that second line needs
to become:

Insert Calculated Result [Year,
DateToText(Date(1, 1, StartYear))
& "..."
& DateToText(Date(12, 31, EndYear))]

Note: The DateToText function may have had it's name changed in
FileMaker 7 and 8.



If you want to find records for various non-consequetive years, then
you'll need a set of Global fields into which the user can enter as
many years as needed. Then the script becomes something like:

Enter Find Mode []
Set Field [Year, Global_FindYear1]
If (Not (IsEmpty(Global_FindYear2))
New Record / Request
Set Field [Year, Global_FindYear2]
End IF
If (Not (IsEmpty(Global_FindYear3))
New Record / Request
Set Field [Year, Global_FindYear3]
End If
etc.

Again, if the Year field you performing the find on is actually a Date
field you have to play with the Date and DateToText functions to get
the year into a proper Date format.


You could try one Global field and have users separate the years by a
carriage return, but I haven't tried that and it's not as
user-friendly.


The other way is to avoid Global fields and simply let the user enter
the find data into the Year field itself (preferabably on a layout that
is in List view to save user confusion of not seeing all the requests),
then you can have an "add year" button that simply creates runs the New
Record / Request command, and then a "Perform Find" button to actually
peform the find.

The problem here can be users somehow getting out of Find Mode and
changing actual record data. You can try to script / protect around
this, but it's usually safer to use Global fields.




Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
  #5  
Old   
Remi-Noel Menegaux
 
Posts: n/a

Default Re: Collecting find criteria (newbie question) - 11-19-2005 , 12:14 AM



For what I understand, you can make a layout with 4 globals, one per
year. The user puts a cross (an "X"") in the ones he chooses.

Then your script searches all the 4 requests in one Find :

- 'Enter Find Mode'
- If ( gyear1= "X")
- then your search actions
- End If
- New Record / Request
- If ( gyear2= "X")
- action2
- End If
- New Record / Request
- etc.
- Perform Find (replace found set)

You add the usual test if there is no record found.
Remi-Noel


"Carla" <carla_sloan (AT) yahoo (DOT) co.uk> a écrit dans le message de news:
1132314187.644293.3320 (AT) f14g2000...oglegroups.com...
Quote:
Can anyone suggest a simple and elegant method for this? I need to do
a Find, based on the user's selection of certain criteria. This can
be
any combination of 4 different years, i.e. 2005, 2004, 2003, 2002. I
think I'm OK with actually scripting the Find (with extending the
found
set, etc.), but I'm struggling with actually collecting the criteria.
I think I need a separate layout on which the user selects the years
(but how?), and then a method of using these criteria in a find.

Maybe I'm making this unnecessarily complex?

Any help would be greatly appreciated!

Carla Sloan




Reply With Quote
  #6  
Old   
Carla
 
Posts: n/a

Default Re: Collecting find criteria (newbie question) - 11-19-2005 , 07:39 AM



Thanls so much, all of you - I now have exactly what I need, using Y/N
radio buttons, and a script using New Record/Request, as suggested.
Simple stuff, but I couldn't have got there without you!

Carla.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.