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



Posts: 48
Joined: Nov 30th, 2002
Re: Lookup Failure
Reply #15 - Nov 19th, 2005 at 9:01pm
Print Post Print Post  
Quote:
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.

YOU ARE NOT ALONE!  Grin
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Lookup Failure
Reply #16 - Nov 19th, 2005 at 9:31pm
Print Post Print Post  
Quote:
Or maybe it can't be done? At any rate, why not give the user the option?

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.


And, as Carl pointed out, Sesame does retain the capability, and allows the programmer the choice.

Supporting XLookup (as opposed to @XLookup) was not something that the author of Q&A 5.0 and SBasic (Andreas Goebels) wanted to do. Directly writing to LEs without opportunity for data integrity checking is highly dangerous and should never be done. It was discouraged in Q&A (as you pointed out) and is discouraged in Sesame. Without variables, Q&A Basic was forced to use additional form fields to hold temporary variables. That, of course, is no longer necessary, and eliminates the need to ever use XLookup (as opposed to @XLookup).

In any case, XLookupAll, XLookupSourceList, and XLookupSourceListAll, provide any number of field values to be returned from an external database. Using XLookupSourceListAll, you can actually return the entire external database, if you choose.

Also, since the X family of commands accept search specs as keys, you can also return a range of values, or find close matches.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Lookup Failure
Reply #17 - Nov 19th, 2005 at 9:47pm
Print Post Print Post  
Quote:
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.

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.


I understood your idea. I was pondering on how that might occur. It has to be some variation on multiple servers (remembering that standalone mode has an embedded server) accessing the same app. If Spencer loads AppA standalone, and AppA loads AppB through an XLookup, then if he loads AppB in another standalone (both server and client) - he is taking advantage of the loophole I discussed.

Ordinarily, if the first server accessed the app, the app would be locked, prohibiting the second server from loading that app. But, since the first server loaded the app using an xlookup, the app is not locked nor is it unloaded from the first server. So the first server would not be able to find the new value as entered by the second server.
  

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 #18 - Nov 19th, 2005 at 9:51pm
Print Post Print Post  
Mark -

I thought I was following everything here, but I got a bit confused after your last comment.

Quote:
And, as Carl pointed out, Sesame does retain the capability, and allows the programmer the choice. 


Are you saying that I can write one programming statement for xlookup to retrieve (as many as) 20 (or perpaps more) values and insert them in the appropriate fields?

Or (as carl aslo said),: Quote:
It returns a semicolon delimitted list that you can manipulate with the StringArray functions.
do I need to learn StringArrayfunctions (which I haven't begun to look at yet) and write additional programming for it to happen?

If it's the latter then, perhaps sample programming would be helpful. 

Certainly I would still like the convenience we had with the one programming statement (as in Q&A) which I used for years and never encountered a single problem.

Should you communicate with Andeas, by the way, please give him my best regards.

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 #19 - Nov 19th, 2005 at 9:57pm
Print Post Print Post  
Quote:
Also, since the X family of commands accept search specs as keys, you can also return a range of values, or find close matches.

This ability to accept search specs as keys make Sesame's X functions versatile. And Sesame is not limited to just the first 16 characters when looking for a match of the key value.
  


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 #20 - Nov 19th, 2005 at 10:04pm
Print Post Print Post  
Quote:
I understood your idea. I was pondering on how that might occur. It has to be some variation on multiple servers (remembering that standalone mode has an embedded server) accessing the same app. If Spencer loads AppA standalone, and AppA loads AppB through an XLookup, then if he loads AppB in another standalone (both server and client) - he is taking advantage of the loophole I discussed.

Ordinarily, if the first server accessed the app, the app would be locked, prohibiting the second server from loading that app. But, since the first server loaded the app using an xlookup, the app is not locked nor is it unloaded from the first server. So the first server would not be able to find the new value as entered by the second server.

Roll Eyes Oh, okay, now I see why you were talking about the lock status of AppB. It makes sense when you explain it that way.
  


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 #21 - Nov 19th, 2005 at 10:25pm
Print Post Print Post  
It requires multiple statements (and should!). Carl provided the page number of an example (page 91), though I am not sure if he is in the 1.1 manuals or the 1.0. The example:
Code
Select All
var returnVal as String
returnVal = @XLookupSourceList(@Fn, IDNo, "IDNo", "Last Name;First
Name;City")
 


Shows getting the values. There are examples of @AccessStringArray to show you how to use them.

There are two reasons Sesame does not support the multiple argument version of XLookup. One is a "good programming" reason, the other is purely technical. Both were Andreas's decision. The "design" reason is to discourage "blind copies" to LEs. The only way to maintain data integrity when dealing with a mandated blind copy is to pre-preserve the value of the LE, write over that LE's value, and then restore the value if the data is incorrect or there is an error. The other reason has to do with strong data typing. Here, Andreas was limited in his choices by Lantica's founders. He wanted to have weak data typing (like Q&A), but the Q&A consultants wanted strong data typing to prevent the problem where data is incorrect for the data type, but otherwise not detectable - throwing off the math, etc... (I was neutral). It is next to impossible to support multiple arguments to a subroutine unless all of the arguments are of the same type. Under weak data typing they would all be of type string, but under strong typing they could be any type (string, number, date, etc...) This precludes the data conversion that is necessary when directly writing to an LE, in that the code cannot determine the type of the second, third, etc... arguments when removing the values from the argument stack.

Personally, I would like very much to change this. It is the hardest part of a Q&A conversion. I would like as much of SBasic to convert without user intervention as is possible. I have looked a couple of times into altering SBasic to support multiple args to XLookup. I agree with the design reasons not to use it, and would recommend that everyone get out of bad habits (even if the bad habit is convenient), but having it there for Q&A conversions would be helpful.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Lookup Failure
Reply #22 - Nov 19th, 2005 at 10:35pm
Print Post Print Post  
Quote:
Mark -

Should you communicate with Andeas, by the way, please give him my best regards.

Thanks!


Its been a little while. I owe him a trip to Germany.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Lookup Failure
Reply #23 - Nov 19th, 2005 at 10:41pm
Print Post Print Post  
Quote:
Roll Eyes Oh, okay, now I see why you were talking about the lock status of AppB. It makes sense when you explain it that way.


The explanation (yours or mine) still doesn't quite make sense, because Spencer also said that after the second server dropped, he could then access the value from the first server. Having the second server drop wouldn't write anything that wasn't already written, nor would it notify the first server of any change in status (causing it to reload). I would think that there wouldn't be a change until the first server drops and reloads.
  

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 #24 - Nov 19th, 2005 at 10:50pm
Print Post Print Post  
The more that is written the more confused I get.  Up until now I have only heard the term client/server used in conjunction with networked systems where the server contained the "permanent" files and the client (a "remote" user) either accessed those files remotely ... or a copy was made on the client's machine (while other people could have access to the server's database but could not change anything) and the client saved the changes and it was copied back to the server (OR SOMETHING TO THAT EFFECT).

It is not important (for me) to understand all this.  What it sounds like your saying - and this is the part that I do want to know - is that when I a single user on a single machine open my database - there comes into excistence both a client and server?

Yes, no, maybe, what??

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 #25 - Nov 19th, 2005 at 11:05pm
Print Post Print Post  
It depends on how rigorous you want to be with terminology. Sesame has three modes of operation all built into the same executable: client, server, and standalone.

In reality there is code that knows how to read and write data to your applications. We call that the "engine". There is code that knows how to communicate with a network. There is code that knows how to draw forms and run SBasic. Using any of the three modes simply tells Sesame which portions of the code it should run.

Sesame as a server runs the engine and the communications. Sesame as a client runs the GUI and the communications. Sesame as standalone runs the engine and the GUI, but not the network communications.

Its always really the same code though. A Sesame client just knows that it is not allowed to run the code in the engine portion of Sesame, instead it uses the communications code to talk to a server (whether on a different machine or on the same machine). Sesame as a server knows not to run the GUI/SBasic code, and instead uses communications to tell a client to run that code.

Sesame running standalone, uses the engine and the GUI. They talk to each other using a communications layer, but that layer does not call the networking code. Instead its calls routines that only uses "pipes".
  

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 #26 - Nov 19th, 2005 at 11:12pm
Print Post Print Post  
Mark -

Quote:
Its been a little while. I owe him a trip to Germany.


He's already there, why would he need another trip?  Ohhhh, you must mean visit (from you).  lol

OK, kidding aside, back to this issue (which I hope won't be forgotten in this cross-discussion of a simple lookup failure and the topic of multiple lookups/saves).

First, of all, Carl was referring to Version 1.1 of the Programmer's Guide when he referred to "page 90."  The only coding provided there however is how to do the lookup.  It is very clear and straight-forward and easy to do .... so in the absence of a simple xlookup with many returns into the associated fields, this is certainly a help.

The coding example I would like to see is the use of stringarrays (Greek to me) that would be used to take the returned fields - to continue with your example - of Last Name, First Name, City and get each value into the appropriate LED fields, also named (but perhaps in a different order) of:  FirstName, LastName and City.

Also, I can't see why a lot of weight (if any) should be given to the programmer's "liability" for not screwing up his/her own database.

It seems to me that even with the use of arrays, I could conceivably wipe out critical data etc. etc.  (I'm not sure whether I could enter a text field into a numeric one or vice versa with string arrays).

Also, look at the risk in multiple clear statements (where I could accidentally wipe out a critical field) or a mass update where I could literally screw up every single field in there.  So I think (so long as Lantica provides appropriate "cautions" .. and certainly you do ... the individual Sesame programmers need to take the "risk" into account and decide if it's worth it.  Personally, I always like to have the option of "ease of use."

Now, assuming we never get the xlookup that at least a few of us (if not more) want, couldn't Andreas develop a utility program that will do the multiple x-lookups when converting Q&A to Sesame?  (He's a very clever guy). 

Anyhow, I want to be clear that having one statement to place lookup values where I want them is certainly not as important as some other things that are needed.  But, still, it would be nice to have and with appropriate caution to the the user - the user could then decide whether it's worth the risk or not.

After all this cross-talk I do hope my original "issue" will have some light shed on it.  If not, it can go in the "life's never-to-be answered questions" file.  lol

  

- 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 #27 - Nov 19th, 2005 at 11:16pm
Print Post Print Post  
BTW, this subject is covered in some detail starting on page 483 of the user's manual.

For practical reasons we often refer to the engine as "the server", even when discussing Sesame standalone. For the purposes of file locking, it makes no difference if Sesame is standalone or acting as a server, in either case always try to abide by the rule: "only one server may have a single app at a time". X commands are an exception to this rule, and thereby create loopholes, such as the one I am discussing with Carl.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Lookup Failure
Reply #28 - Nov 20th, 2005 at 12:00am
Print Post Print Post  
Quote:
Mark -


He's already there, why would he need another trip?  Ohhhh, you must mean visit (from you).  lol

Yeah. Lantica and Hammer have asked Andreas over the ocean many times. The last time he was here, he insisted that we need to come to him next time.
Quote:
OK, kidding aside, back to this issue (which I hope won't be forgotten in this cross-discussion of a simple lookup failure and the topic of multiple lookups/saves).

First, of all, Carl was referring to Version 1.1 of the Programmer's Guide when he referred to "page 90."  The only coding provided there however is how to do the lookup.  It is very clear and straight-forward and easy to do .... so in the absence of a simple xlookup with many returns into the associated fields, this is certainly a help.

The coding example I would like to see is the use of stringarrays (Greek to me) that would be used to take the returned fields - to continue with your example - of Last Name, First Name, City and get each value into the appropriate LED fields, also named (but perhaps in a different order) of:  FirstName, LastName and City.

String arrays are pretty easy and save a lot of coding.
Quote:
Also, I can't see why a lot of weight (if any) should be given to the programmer's "liability" for not screwing up his/her own database.

Its not the liability, its the inability to prevent it that concerns us. In Q&A, you had no choice but to either do a blind copy from XLookup, or create an "extra" field on your form with no other purpose than to catch the value of an @XLookup. A blind copy provides no way to prevent damage, even if you know to do so. Using an extra field bloats the database and creates opportunities for corruption and error. It must also be hidden from the end user.

Because it provides no way to check for errors, in execution or in data, even if allowed, a blind copy should never be used. That gives the careful programmer no choice but to use an "extra" field.
Quote:
It seems to me that even with the use of arrays, I could conceivably wipe out critical data etc. etc.  (I'm not sure whether I could enter a text field into a numeric one or vice versa with string arrays).

Of course you could, but you don't have to. Using variables (especially) you have the opportunity to check for both data and execution errors before your critical LEs are overwriiten. In addition, you have an opportunity to filter, manipulate, and examine the data you are working with. It is not a blind copy. You can check the value before you write it to the LE.
Quote:
Also, look at the risk in multiple clear statements (where I could accidentally wipe out a critical field)

With clear, you are writing a known value - it is not a blind copy.
Quote:
or a mass update where I could literally screw up every single field in there.  So I think (so long as Lantica provides appropriate "cautions" .. and certainly you do ... the individual Sesame programmers need to take the "risk" into account and decide if it's worth it.  Personally, I always like to have the option of "ease of use."

Again, with a mass update, you can see the value you are going to write before you write it to the LE. It is not a blind copy like XLookup.
Quote:
Now, assuming we never get the xlookup that at least a few of us (if not more) want,

There is no reason to assume that. As I mentioned, I would like to put it in to Q&A compatibility reasons.
Quote:

couldn't Andreas develop a utility program that will do the multiple x-lookups when converting Q&A to Sesame?  (He's a very clever guy). 

Andreas could (no doubt) do that, but it would be much more efficient (for everybody, machines and people) to use a single XLookupSourceList.
Quote:
Anyhow, I want to be clear that having one statement to place lookup values where I want them is certainly not as important as some other things that are needed.  But, still, it would be nice to have and with appropriate caution to the the user - the user could then decide whether it's worth the risk or not.

Like I said, I want it for compatibility reasons. I still don't recommend its use. I have a large collection of Q&A databases (~6000). I collected them while we were working on the translator. All of them were in use in the real world at some time. Almost every single one of them exhibited data corruption (the application was working perfectly but the data was incorrect by type). Almost all of them had structural corruption. This was usually minor but did create "bad" records (that could return values to an XLookup). More than half of them had profound structural corruption, and while the app would run (and give little or no indication that it was failing), it was actually failing on a significant portion of the application. Many (~10%) had ongoing corruption, where using the database was actually causing it to destroy data. Many of the worst were unreadable in any program.

A blind copy can easily propogate incorrect or corrupt values, and provides no means of determining if it has done so. Love, but do not trust, your data.
Quote:
After all this cross-talk I do hope my original "issue" will have some light shed on it.  If not, it can go in the "life's never-to-be answered questions" file.  lol

I haven't looked (yet) to see what is going on with your specific situation (wherein an XLookup failed until the second server was dropped), but assuming you want a remedy, you can either hold off on the XLookup until you are finished using the second server (since you are just one user) or run both clients on a single server using client/server (which should be your end goal if you are ever intending to have multiple users later).
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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 #29 - Nov 20th, 2005 at 3:36pm
Print Post Print Post  
Quote:
If it's the latter then, perhaps sample programming would be helpful.


Spencer,

Here is a program that retreives four values using @XLookupSourceList. It then uses @AccessStringArray to assign each value to its proper place. All the values are simply assigned, except for Currency, which is checked for validity before assignment.

Code
Select All
var vVals as String
var vVal as Double

	vVals = @XLookupSourceList(@FN, "1000", "Main Form!KEY", "Company;State;Phone;Currency")
	If Not @Error
	{
		Company = @AccessStringArray(vVals, 1)
		State = @AccessStringArray(vVals, 2)
		Phone = @AccessStringArray(vVals, 3)
		vVal = @ToNumber(@AccessStringArray(vVals, 4))
		If vVal > 0
		{
			Currency = vVal
		}
	}
	Else
	{
		@MsgBox("XLookup failed!", "", "")
	}
 

  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 
Send Topic Send Topic Print Print