Hot Topic (More than 10 Replies) XLookupAll mystery (Read 1674 times)
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
XLookupAll mystery
Nov 26th, 2010 at 4:09pm
Print Post Print Post  
I have two LE’s in a database that are causing me trouble, CusName & Location.

If I use this; vRS = @XLookupAll(@fn, “M..”, "Customers!cusname", "cusname") I get all the names beginning with M, and the same with location, if I replace Cusname with Location, I get all Locations that begin with M.

If I use this; vRS = @XLookupAll(@fn, “/=”, "Customers!cusname", "cusname") I get no results with CusName or Location.  

I'm not having this trouble with any of the other LE's in the App.

Any idea why I’m not able to use “/=” on these two LE’s when it’s working on all the others?

Thanks.
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: XLookupAll mystery
Reply #1 - Nov 26th, 2010 at 6:40pm
Print Post Print Post  
Does @error tell you anything?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: XLookupAll mystery
Reply #2 - Nov 26th, 2010 at 8:58pm
Print Post Print Post  
Hi Mark,

@error returns no
  
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: XLookupAll mystery
Reply #3 - Nov 26th, 2010 at 9:08pm
Print Post Print Post  
Actually, the first time I ran it, I ran it like this;

vRS = @XLookupAll(@fn, "/=", "Customers!cusname", "cusname")
writeln(vrs)
writeln(@error)

That return the no.

When I run it like this, which I think is the correct way;

vRS = @XLookupAll(@fn, "/=", "Customers!cusname", "cusname")
writeln(@error)

I get the same no.
  
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: XLookupAll mystery
Reply #4 - Nov 27th, 2010 at 1:43am
Print Post Print Post  
Interesting update.

I wondered if there was something in the data causing the "/=" not to work with @xlookup so I searched for anything that wasn't text and deleted them. That didn't make a difference so I started deleting records. The customers database contains 2570 records. When I reduce the number of records to around 1200 records(I say "around" because I can't find an exact number) the code @XLookupAll(@FN, "/=","Customers!name","name") works.

Any thoughts on this?

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



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: XLookupAll mystery
Reply #5 - Nov 27th, 2010 at 2:51am
Print Post Print Post  
I can confirm the issue that you are seeing. I ran a test myself on a database with 3118 records in it. The following code produces an empty slate (except for the count result of 2711), but a full list in the PopupChoiceList.

Code
Select All
var vRS as String
var vAns as String

vRS = @XLookupAll(@Fn, "/=", "Checkbook!Name", "Name")
WriteLn(vRS)
WriteLn(@CountStringArray(vRS))
vAns = @PopupChoiceList(vRS, "Make a Selection")
 



It appears to simply be a problem with too many lines for the slate to display properly. I seem to remember running across this before at some time in the past.
  


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



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: XLookupAll mystery
Reply #6 - Nov 27th, 2010 at 3:10am
Print Post Print Post  
There is definitely a limit to the what the slate will display at one time. The sample text in vStr1 below will display in the slate if there are 73 copies of it. But, if you change the @Text line to contain 74 instead, the slate will be blank.

Code
Select All
var vStr1 as String
var vStr2 as String

vStr1 = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. "

vStr2 = @Text(73, vStr1)
WriteLn(vStr2)
 

  


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



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: XLookupAll mystery
Reply #7 - Nov 27th, 2010 at 3:50am
Print Post Print Post  
Thanks for confirming this Carl.

I originally used, and continue to do so, @XResultSetSearch but it was taking almost three seconds or so for the choice window to populate and I was looking for a faster alternative. There's 79 LE's on a Customers record. I remember reading somewhere that with @XResultSetSearch you get "all the fields", and I thought I'd try to use @Xlookup because maybe it was just getting data from the LE you're searching in, thinking it might be faster.  Of course, I don't know this to be true and could be all wet on this theory.

Thanks again for looking at this, it makes me feel better to know that it may not be something that I have done.

Brandon



  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: XLookupAll mystery
Reply #8 - Nov 27th, 2010 at 5:15am
Print Post Print Post  
The slate is actually a circular buffer with a fixed limit, probably based on the number of pixels tall the underlying virtual window is allowed to be on your OS. So, yes, if you populate it with enough content on a single write, it will have problems. You may be able to compensate by writing to the slate using smaller chunks rather all in one go.

Also, yes, you must call @error immediately after the function/subroutine you are interested in testing. Each function or subroutine resets the value before it operates.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: XLookupAll mystery
Reply #9 - Nov 27th, 2010 at 12:03pm
Print Post Print Post  
After further review, thinking of your code Carl, and sleeping on it..

it turns out that I have been sending the results to a Writeln() window only, thinking this would be the same as a @PopupChoiceList window. Everything works fine when the results are sent to a @PopupChoiceList window. So, its no big deal at all, sorry.

So, my next question is, is it possible to have  @XLookUpAll combine two LE's like I do using @XResultSet commands like this; vLocation + " " + "-" + " " + vLocAddress + ";" which would result in a @PopupChoiceList window list like this;

Location - Address
Location - Address

Thanks for the help.
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: XLookupAll mystery
Reply #10 - Nov 27th, 2010 at 7:02pm
Print Post Print Post  
Take a look at @XLookupSourceListAll.

XResultSet commands are usually faster than XLookup commands. You may want to compare both methods for speed.
  


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



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: XLookupAll mystery
Reply #11 - Nov 27th, 2010 at 9:21pm
Print Post Print Post  
Thank you Carl,

If the results could be sent to a @PopupChoiceList window that would be great. I'll have to stick with the XResultSet commands.

Thanks much,

Brandon

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



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: XLookupAll mystery
Reply #12 - Nov 28th, 2010 at 1:44am
Print Post Print Post  
Quote:
If the results could be sent to a @PopupChoiceList window that would be great.

Of course they can.  Smiley

The code below is a modified version that appears in the manual, under @PopupMenu (but don't use @PopupMenu -- @PopupChoiceList is better).

Code
Select All
var vChoice as String
var vValList as String

// Get the list of the Names and Locations
vValList = @XLookupSourceListAll(@FN, "M..", "Customers!CusName", "CusName;Location")

// Replace the semicolons with hyphens
vValList = @Replace(vValList, ";", " - ")

// Replace the line breaks with semicolons so the
// whole thing can be passed to @PopupChoiceList.
vValList = @Replace(vValList, @NewLine(), ";")

// Sort the semicolon separated list and remove duplicates
vValList = @UniqueStringArray(@SortStringArray(vValList, 0))

// Show the list
vChoice = @PopupChoiceList(vValList, "Make a Selection")

// Optionally, split the result to diplay only the data before the hyphen
//vChoice = Split(vChoice, "-")

WriteLn(vChoice)
 

  


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



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: XLookupAll mystery
Reply #13 - Nov 28th, 2010 at 3:17pm
Print Post Print Post  
Thank you for this Carl, that's outstanding!

The only thing I added was this; @Replace(vValList,"&","\&") so that any of the locations with an ampersand could be searched for.

As it turns out the @XLookUp is much faster in this case than @XResultSet. Again, my guess is that @XResultSet is returning all the data in all the fields in the resultset versus @XLookUp returning only the data in the field you specify?

Thanks again, I really appreciate your knowledge & availability, especially on the weekends.

Have a great day,

Brandon
  
Back to top
IP Logged