Normal Topic @XResultSetSearch results help (Read 413 times)
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
@XResultSetSearch results help
Jan 12th, 2012 at 12:43pm
Print Post Print Post  
vRS = @XResultSetSearch(@FN, "SERVICES DATA", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!SDAno=" + DAno,"!YEARa="  + YEAR2)

The LE’s DAno & YEAR2 in the MAIN database are both bound to type TEXT.

The LE’s SDAno & YEARa in the SERVICES DATA database are both bound to type TEXT.

Programming runs on ON ELEMENT EXIT on the YEAR2 LE.

If YEAR2 contains the correct year, i.e., 2011, vCount = 1, and the result is correct.

If YEAR2 contains a letter or a number but not 2011, vCount = 0, and it correctly returns nothing.

If YEAR2 is empty, vCount equals the number of records in the SERVICES DATA base, and it incorrectly returns the first record found in the SERVICES DATA database.

When I make YEAR2 a variable, vYEAR2, and declare it as INT, the code works except if YEARa is a letter rather than a number.

I thought that in order to get a result, both conditions have to be met. For example, if I set SDAno to 4444, and YEARa is blank, and there are no records like that, why should vCount not equal 0?

Does this mean that a number in a text box is still a number?

What do I have to do so that numbers or text can be placed in the YEARa LE in the SERVICES DATA database and the @XResultSetSearch finds them, but when YEAR2 is left empty it returns nothing,(or vCount = 0) rather than the first SERVICES DATA record?

What am I missing, thanks for help with this.
  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: @XResultSetSearch results help
Reply #1 - Jan 12th, 2012 at 3:25pm
Print Post Print Post  
Hello,

tcgeo wrote on Jan 12th, 2012 at 12:43pm:
I thought that in order to get a result, both conditions have to be met. For example, if I set SDAno to 4444, and YEARa is blank, and there are no records like that, why should vCount not equal 0?


When Year2 is blank the search is performed just like if YearA was left blank at the retrieve spec. No criteria in a field means every record matches.

What you'll want to do is something like
Code
Select All
Var vYear as String

If @IsBlank(YEAR2) Then
{
	vYear = "="
}
Else
{
	vYear = YEAR2
}

vRS = @XResultSetSearch(@FN, "SERVICES DATA", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!SDAno=" + DAno,"!YEARa="  + vYear)
 

  

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



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @XResultSetSearch results help
Reply #2 - Jan 12th, 2012 at 3:32pm
Print Post Print Post  
Hi Ray,

Thank you.  For some reason I was thinking that by leaving YEAR2 blank would be the same as using "=" for the search.

Thanks for straightening me out, have a great day.
  
Back to top
IP Logged