Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Multiple Searches (Read 1936 times)
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Multiple Searches
Feb 7th, 2006 at 11:01pm
Print Post Print Post  
I am doing the following search where I only want specific records that contain an employee's initials in multiple combo boxes, but only where the project is not completed as follows:

STA1 = search spec is "JAD"
STA2 = search spec is "JAD"
STA3 = search spec is "JAD"
DATE COMPLETED = search spec is "=" (empty)

If I set the search option to Meet All Restrictions, obviously, it won't return any records.

If I set the search option to Meet Any Restrictions, it returns all records with any one of the criteria above, resulting in too many unwanted hits.

Is there another way around this ?  I am trying to use this saved spec in my reports.

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Multiple Searches
Reply #1 - Feb 8th, 2006 at 1:43am
Print Post Print Post  
A "Programmed Retrieve" (or "Programmed Expression") spec should handle this.
They look like this: >{@Date}
this: ={@Date - 7}
or this: {Name = "Adam"}

Also, you can use @Rest() if you need to use wildcard type searches within the programmed retrieve. (i.e. "A..", or "..ville..", "..ed", etc.)

Try something like this (in any LE on the form):
Code
Select All
{ ( STA1 = "JAD" or STA2 = "JAD" or STA3 = "JAD" ) and @Rest(DATE COMPLETED, "=") } 



  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Multiple Searches
Reply #2 - Feb 8th, 2006 at 2:02am
Print Post Print Post  
BTW, I almost forgot, you could also use @IsBlank() within the programmed retrieve like this:
Code
Select All
{ ( STA1 = "JAD" or STA2 = "JAD" or STA3 = "JAD" ) and @IsBlank(DATE COMPLETED) } 

  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Multiple Searches
Reply #3 - Feb 8th, 2006 at 2:29pm
Print Post Print Post  
For some reason, neither of the two statements work.  As additional info, the STA fields are unlabeled combo boxes and have field names of STA1, STA2, STA3 and are bound to the same name respectively.

Does this matter as according to the Programming Retrieves section of the manual, expressions require field names and not layout element names.

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Multiple Searches
Reply #4 - Feb 9th, 2006 at 1:36am
Print Post Print Post  
It definately needs to be the Field name, not the LE name.

Your statement, "the STA fields are unlabeled combo boxes and have field names of STA1, STA2, STA3 and are bound to the same name respectively", is a little confusing. The "Bound To" name is the Field name.

Make sure to use the name that appears in the Property Viewer on the "Bound To" line, but without the leading exclaimation mark (!).

I have found that if ANY of the field names are incorrect, the ENTIRE statement will not find any matching records, even if logically it should. One misspelled field name ruins the entire statement. For example, the following statement will find many Tools category records and one record with check number 20101.

{ Category = "Tools" or Check No = "20101" }

But, if Category is misspelled as Catagory, Sesame finds no matching records. It should still find the check numbered 20101, but it doesn't.

So, be very careful that your spelling matches the Bound To name for the LE you want to search on. If that does not solve it for you, I'm not sure what else it would be without looking at the application.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Multiple Searches
Reply #5 - Feb 9th, 2006 at 2:09am
Print Post Print Post  
Quote:
It definately needs to be the Field name, not the LE name.

Your statement, "the STA fields are unlabeled combo boxes and have field names of STA1, STA2, STA3 and are bound to the same name respectively", is a little confusing. The "Bound To" name is the Field name.

Make sure to use the name that appears in the Property Viewer on the "Bound To" line, but without the leading exclaimation mark (!).

All true. The retrieve programs run on the database engine. The database engine doesn't know anything about LEs. It only knows about fields.
Quote:
I have found that if ANY of the field names are incorrect, the ENTIRE statement will not find any matching records, even if logically it should. One misspelled field name ruins the entire statement. For example, the following statement will find many Tools category records and one record with check number 20101.

{ Category = "Tools" or Check No = "20101" }

But, if Category is misspelled as Catagory, Sesame finds no matching records. It should still find the check numbered 20101, but it doesn't.


The reason is that the retrieve program is just that - a program. If SBasic cannot compile the program (because something was misspelled or any other syntax error) the whole program can't run.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Multiple Searches
Reply #6 - Feb 9th, 2006 at 4:37am
Print Post Print Post  
Quote:
The reason is that the retrieve program is just that - a program. If SBasic cannot compile the program (because something was misspelled or any other syntax error) the whole program can't run.

Thank you, Mark, for this explanation. I was wondering why it did that. Now it makes sense.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Multiple Searches
Reply #7 - Feb 9th, 2006 at 3:24pm
Print Post Print Post  
The bound to names are as such: STA1, STA2 and STA3.

Therefore, the statement contains the right field names but still does not work.

Is it a valid statement ?

{ ( STA1 = "JAD" or STA2 = "JAD" or STA3 = "JAD" ) and @IsBlank(DATE COMPLETED) }

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Multiple Searches
Reply #8 - Feb 9th, 2006 at 3:43pm
Print Post Print Post  
I know this type of syntax works. I just ran a test on one of my apps with this spec:
Code
Select All
{ (Category = "PW" or Category = "Auto" or Check No = "20101") and (Not @IsBlank(Check Date)) } 


That does retrieve records for me. Though it did not, until I put the "(Not...)" portion around the @IsBlank function.

Are you sure that you have records that meet the criteria you are asking for in the spec? Retrieve a record using just one of the basic specs, and verify that you are asking for something that is actually in the database. Or build a test spec for any record that you can pull up, being sure to tailor it to find that record, and see if you can make it find that record.


  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Multiple Searches
Reply #9 - Feb 9th, 2006 at 4:19pm
Print Post Print Post  
Well, I have verified that there are records that match my criteria, either with a Date Completed or not.

I tried the ( Not.. ) but it didn't help either.

I am stumped right now as I have double checked all the field names and even changed the initials "JAD" to another set of initials.

I will keep trying to see if I have erred somewhere.

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Multiple Searches
Reply #10 - Feb 9th, 2006 at 4:34pm
Print Post Print Post  
Have you tried......

From:
{ ( STA1 = "JAD" or STA2 = "JAD" or STA3 = "JAD" ) and @IsBlank(DATE COMPLETED) } 

To:
{ (( STA1 = "JAD") or (STA2 = "JAD") or (STA3 = "JAD" )) and @IsBlank(DATE COMPLETED) } 

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Multiple Searches
Reply #11 - Feb 9th, 2006 at 5:21pm
Print Post Print Post  
Bob:

I copied your statement in but it stills doesn't work.

I made sure the search options were set to Meet Any restrictions.

It has to be something silly that is throwing me off.

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Multiple Searches
Reply #12 - Feb 9th, 2006 at 5:28pm
Print Post Print Post  
Hello Louis,

Start with something simple like

{(STA1 = "JAD")}

See if it retrieves records. If it does then move on to

{( STA1 = "JAD" or STA2 = "JAD")}

and so on and so on. Let us know when it stops working.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Multiple Searches
Reply #13 - Feb 9th, 2006 at 7:36pm
Print Post Print Post  
Ray:

Programming stops working at "and @IsBlank(Date Completed).

Field name is called Date Completed and bound to the same.

Thanks,

Louis

  

Louis Galvao
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Multiple Searches
Reply #14 - Feb 9th, 2006 at 7:45pm
Print Post Print Post  
Hello Louis,

Try changing the field name to Date_Completed in SDesigner in Manage Fields. Let me know if it works after that.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print