Page Index Toggle Pages: [1] 2 3  Send Topic Send Topic Print Print
Very Hot Topic (More than 25 Replies) Lookup Failure (Read 3399 times)
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Lookup Failure
Nov 18th, 2005 at 4:57pm
Print Post Print Post  
Hi -

I have programming in my database that looks up the first five digits of a zip code (to the sample zip-code database).  It has worked flawlessly for quite some time now.

I just did a lookup that failed and discovered that the zip code was "new" and was not in the zip code database.  I added the new zip code (along with other relevant information) to the zip code database.  I closed the database, went back to my working database, did the lookup and it failed.

I went back to verify that I could search for that zip code in the zip code database and it worked.  I was totally baffled.

I tried closing my working database and reopened it and it worked just fine. I don't understand why I had to close and reopen the database before the lookup would work. Is there a "flaw" in the program ... or is there a reason I'm unaware of?

Thanks!
« Last Edit: Nov 19th, 2005 at 3:22pm by SpencerWulwick »  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Lookup Failure
Reply #1 - Nov 18th, 2005 at 5:10pm
Print Post Print Post  
Are you sure that the lookup code actually ran the second time? If you have a condition to make sure it only runs once, then it may not have run until you left the record and went back to it.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Lookup Failure
Reply #2 - Nov 18th, 2005 at 5:17pm
Print Post Print Post  
Hi -

There is nothing in the programming statement to have it only run once. That way it will execute should I change the address & zip code.  Unless I make a change I am rarely in the zip code field, so the programming does not execute needlessly.

The only "condition" in the programming is that if the zip code field is blank, it will not perform the lookup.

And I had tried everything I could think of, including leaving the record and coming back to it.  Only when I closed the working database and reopened it did the lookup work (and yes, in that cirumstance) the lookup defnitely worked.

One more thing that I had tried is that I entered an erroneous (but valid) zip code into the field (before I closed the database) and it worked just fine.  Only the new entry to the zip-code database did not work (until I closed and and re-opened the working database).

I do hope that's clearer than mud!    lol
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Lookup Failure
Reply #3 - Nov 19th, 2005 at 1:29am
Print Post Print Post  
Erika,

Is it possible that the zip code db was read into memory, and Sesame was using only what was in memory, rather than checking the disk again. And when Spenser closed the app he was working in, and reopened it, that caused Sesame to re-read the zip code db again from disk, which of couse, now contained the new zip code?
  


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: Lookup Failure
Reply #4 - Nov 19th, 2005 at 12:37pm
Print Post Print Post  
Quote:
Is it possible that the zip code db was read into memory, and Sesame was using only what was in memory, rather than checking the disk again. And when Spenser closed the app he was working in, and reopened it, that caused Sesame to re-read the zip code db again from disk, which of couse, now contained the new zip code?

Depends on his client/server setup. We did find one loophole in the xlookup code that can get around the database locking.
  

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



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Lookup Failure
Reply #5 - Nov 19th, 2005 at 2:46pm
Print Post Print Post  
Hi -

Mark, You said:

Quote:
Depends on his client/server setup. We did find one loophole in the xlookup code that can get around the database locking.


I don't understand what you are saying, particularly with regard to the problem I described.

It might help to know that I am using this on my own computer and although it is networked to 3 others none of the were turned on nor is niether Sesame or any of my databases installed on the other computers.  Would I still have a client/server .... or does that just refer to when there is more than one user?

Does the "loophole" you found in the programming mean that it can be "fixed" so that the lookup situation I described won't fail in the future?

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Lookup Failure
Reply #6 - Nov 19th, 2005 at 2:54pm
Print Post Print Post  
My statement referred to Carl's theory. It is possible under client/server for a server to have application A open and a second server to have application B open. If server with A does an XLookup to application B, and then a client connects to server with A, they can then open application B, as though it was unlocked, even though the server with B, has that application.

I haven't tried your circumstances yet, to know what the circumstances actually are. Today, I am working on human readable/editable macros for 2.0.
  

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



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Lookup Failure
Reply #7 - Nov 19th, 2005 at 3:05pm
Print Post Print Post  
Mark -

I hope at some point, you might be able to look at the situation to see whether there is a "bug" or whether I overlooked something.

If it's any help, here is the programming I am using in the "on element exit" event.

Code
Select All
If not @isblank(zip) then
{
Xlookup("C:\sesame\data\ZipCode.db",@left(Zip,5),"ZipCode!Zip Code","City",City)
Xlookup("C:\sesame\data\ZipCode.db",@left(Zip,5),"ZipCode!Zip Code","State",State)
}
if @error then @msgbox("lookup failed","","") 


I made sure that I went in and out of the zip code field to trigger the programming, including deleting and reentering the zip code, leaving the record and coming back to it, entering it in another record, etc. etc.

But I can certainly be patient to get your response, since most of us will be THRILLED to have "human" readible/editable macros.  (What about the "other" users of Sesame; will they be able to read/edit them also?)   roflol  (To be very clear, that was just a rhetorical question, in JEST!)

Also, looking at my code reminds me of something else I'm curious about. Will version 2.0 allow us to retrieve multiple values with one xlookup statement (I hope, I hope)?

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Lookup Failure
Reply #8 - Nov 19th, 2005 at 6:51pm
Print Post Print Post  
Quote:
My statement referred to Carl's theory. It is possible under client/server for a server to have application A open and a second server to have application B open. If server with A does an XLookup to application B, and then a client connects to server with A, they can then open application B, as though it was unlocked, even though the server with B, has that application.

Mark, I think you misunderstood what I meant. I wasn't reffering to the app being locked. I was reffering to the zip code app being loaded into RAM, and Sesame not checking to see if the file on disk had changed since it last accessed it, resulting in Sesame only looking at the old/outdated data in RAM for subsequent xlookups, until the current working session was closed and restarted; at which time, Sesame had no choice but to read the file from disk. And this time it contained the new zip code record that Spencer had added.

Quote:
Today, I am working on human readable/editable macros for 2.0.

That sounds GREAT! Cheesy

I have often forgot the precise steps that my macros contain, and have wanted to have a way to review and/or tweak them.
  


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: Lookup Failure
Reply #9 - Nov 19th, 2005 at 6:56pm
Print Post Print Post  
Quote:
Will version 2.0 allow us to retrieve multiple values with one xlookup statement (I hope, I hope)?


Have you looked at these?

Quote:
@XLookupAll("filename", key,
"[formName!] ext key", "source")

Same as @XLookup except returns a semicolondelimited
list of values from the source element
in all matching records. Key can be a range, in
quotes, such as "b.."

@XLookupSourceList("filename", Key,
"[formName!] ext key", "sourceList")

Similar to @XLookup but returns, from the first
matching record, the values from the external
elements named in the semicolon-delimited
sourceList.

@XLookupSourceListAll("filename", Key,
"[formName!] ext key", "sourceList")

Same as @XLookupSourceList but returns, from
all matching records, the values from the
external elements named in the semicolondelimited
sourceList.

  


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



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Lookup Failure
Reply #10 - Nov 19th, 2005 at 6:56pm
Print Post Print Post  
Carl,

I'm glad you clarified that because I was very confused by the reference to "locking."

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Lookup Failure
Reply #11 - Nov 19th, 2005 at 7:02pm
Print Post Print Post  
Carl -

I was not familiar with the xlookups you mentioned, so thanks very much for pointing them out.

What I wanted to do specifically - which I understood cannot presently be done - is retrieve multiple values in one lookup statement and have the values entered into appropriate fields.

So, in doing my xlookup based on zip code, I could use one statement to have the city brought back into the city field, the state brought back into the state field ... along with others, e.g. time zone, county or "whatever."

If memory serves me right we could, in Q&A, use one lookup statement and retrieve up to 20 values entered into the appropriate fields.
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Lookup Failure
Reply #12 - Nov 19th, 2005 at 7:43pm
Print Post Print Post  
Quote:
So, in doing my xlookup based on zip code, I could use one statement to have the city brought back into the city field, the state brought back into the state field ... along with others, e.g. time zone, county or "whatever."

@XLookupSourceList is capable of bringing back multiple values from the same record. See the example on page 91 of the latest Sesame Programming Guide. It just doesn't place them in the LE for you. It returns a semicolon delimitted list that you can manipulate with the StringArray functions.

Quote:
If memory serves me right we could, in Q&A, use one lookup statement and retrieve up to 20 values entered into the appropriate fields.

You're correct. I can't remember why they were not implemented in Sesame, but I'm sure there was a good reason. I think it's because they were very inefficient to use - not for you, but for the computer.

  


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



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Lookup Failure
Reply #13 - Nov 19th, 2005 at 7:47pm
Print Post Print Post  
But Carl,

I care more about me than the computer.

After all, I'm 68 and I always have at least one new computer.

lol
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
walt
Member
*
Offline



Posts: 48
Joined: Nov 30th, 2002
Re: Lookup Failure
Reply #14 - Nov 19th, 2005 at 8:54pm
Print Post Print Post  
Quote:
You're correct. I can't remember why they were not implemented in Sesame, but I'm sure there was a good reason. I think it's because they were very inefficient to use - not for you, but for the computer.


Or maybe it can't be done? At any rate, why not give the user the option?

Quote:
"If memory serves me right we could, in Q&A, use one lookup statement and retrieve up to 20 values entered into the appropriate fields."

If I remember correctly, Q&A advised using multiple statements for faster speed, yet adding up to 20 statements in place of just one not only made adding code that much more time consuming but also created a bigger file ultimately triggering the novel "Too many programming statements" message. I used both methods but was forced to opted for the one v. many because of Q&A's file size/memory limitation.

I don't recall why having 20 statements v. one increases speed, but in using both ways I never noticed a difference.

If it can be done, I agree with Spenser that it would be helpful to retain that capability.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 3 
Send Topic Send Topic Print Print