Hot Topic (More than 10 Replies) How do I xlookup a Q&A dtf database? (Read 6168 times)
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
How do I xlookup a Q&A dtf database?
Aug 15th, 2004 at 7:52pm
Print Post Print Post  
I'm using the below program but not having any luck and I cant find any documentation on dtf lookups anywhere.

vstring = @xlookupsourcelistall("C:\Q&A\Inventory.dtf", Stock Number, "Stock #", "Invoice date;Sold by")

where:

Stock number is LE in sesame that contains a matching number to lookup in Q&A

Stock # is the field name in Q&A

Invoice date and Sold By are fields in Q&A containing the data I want to lookup.

I suspect I'm entering the path and filename wrong. Any thoughts?

Thanks,
Steve
  
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: How do I xlookup a Q&A dtf database?
Reply #1 - Aug 15th, 2004 at 9:13pm
Print Post Print Post  
The server log gives this error:

"incorrect version or format".

I'm using q&A version 5.0 (DOS)

Thanks,
Steve
  
Back to top
IP Logged
 
pineberry
Full Member
***
Offline


No personal text

Posts: 115
Location: Strawberry, AZ  USA
Joined: Nov 30th, 2002
Re: How do I xlookup a Q&A dtf database?
Reply #2 - Aug 15th, 2004 at 9:16pm
Print Post Print Post  
does your @xlu work if you only have one source element eg "invoice date" ?
  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: How do I xlookup a Q&A dtf database?
Reply #3 - Aug 15th, 2004 at 9:24pm
Print Post Print Post  
The server log gives this error:

"incorrect version or format".

I'm using q&A version 5.0 (DOS)

Thanks,
Steve
  
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: How do I xlookup a Q&A dtf database?
Reply #4 - Aug 15th, 2004 at 9:31pm
Print Post Print Post  
Uhoh. Now I'm getting an error message inQ&A saying "This is not a q&a database.".

I wasn't getting this error before i tried the xlookups.


I give up.

Steve
  
Back to top
IP Logged
 
pineberry
Full Member
***
Offline


No personal text

Posts: 115
Location: Strawberry, AZ  USA
Joined: Nov 30th, 2002
Re: How do I xlookup a Q&A dtf database?
Reply #5 - Aug 15th, 2004 at 10:15pm
Print Post Print Post  
The following works with QA DOS 4.0

vnum=@xlu(F:\qatest\stk5.dtf",item,"stk#",list)

  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: How do I xlookup a Q&A dtf database?
Reply #6 - Aug 15th, 2004 at 11:28pm
Print Post Print Post  
Pineberry,

Thanks for the suggestions, but still no luck. Only @error is being returned.

However, Using the @xlookup versus xlookupsourcelistall is not 'corrupting' my Q&A database.

Steve
  
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: How do I xlookup a Q&A dtf database?
Reply #7 - Aug 16th, 2004 at 12:01am
Print Post Print Post  
I think that there might be a typo here?
Quote:
vnum=@xlu(F:\qatest\stk5.dtf",item,"stk#",list)
could not work.  Looks like a missing double quote at beginning, like:
vnum=@xlu("F:\qatest\stk5.dtf",item,"stk#",list)

The following works for me as normal @XLU:

Quote:
vtest = @xlookup("n:\data\qa5\ss\db\actions.dtf",857,"RECORD","COMPANY")


But these lines for List and ListAll both come back with blank values:
Quote:
vTest = @XLookupSourceList("n:\data\qa5\ss\db\actions.dtf","SMITH","COMPANY","COMPANY;PR
OJECT") 
and
vTestl = @XLookupSourceListAll("n:\data\qa5\ss\db\actions.dtf","SMITH","COMPANY","COMPANY
;PROJECT")
I think the syntax for the paths is correct, but think that perhaps there is some other error.

I am using WriteLn to see results.  I guess the good news is that they are not generating any error messages
  



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


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: How do I xlookup a Q&A dtf database?
Reply #8 - Aug 16th, 2004 at 12:06am
Print Post Print Post  
Bob, Thanks for your feedback.

I saw the typo and worked around it, but still no luck.

Are your q&a databases opening up ok after using Sourcelistall?

Steve
  
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: How do I xlookup a Q&A dtf database?
Reply #9 - Aug 16th, 2004 at 12:58am
Print Post Print Post  
AAArgh!  NO!

My Q&A file now says it is not a  Q&A database.

WARNING TO ALL......DO NOT TRY TO DUPLICATE WITH A GOOD Q&A DATABASE !

I better have a backup......this was a critical file.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
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: How do I xlookup a Q&A dtf database?
Reply #10 - Aug 16th, 2004 at 1:30am
Print Post Print Post  
Yes, I have a backup from 8/13, not all is lost! Roll Eyes

Will let Erika and Mark work on this one.  Cannot risk real data.

Thanks for asking about that Steve.  I saw no messages, but did not look at the server log.  Will check that out now.
======
From the log:
Failed to open n:\data\qa5\ss\db\actions.dtf - incorrect version or format.
  



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


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: How do I xlookup a Q&A dtf database?
Reply #11 - Aug 16th, 2004 at 4:02am
Print Post Print Post  
Sorry about that! Good thing you got a backup!

I'll wait to hear from Lanticans before I go any further on this one.

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



Posts: 2530
Joined: Nov 22nd, 2002
Re: How do I xlookup a Q&A dtf database?
Reply #12 - Aug 16th, 2004 at 2:22pm
Print Post Print Post  
With the exception of XListValues, "X commands" that didn't exist in Q&A are not supported on Q&A databases. So:

XLookupAll
XLookupSourceList
XLookupSourceListAll
XPostAll

do not support Q&A .dtf files!

Bob,
It is likely that your .dtf file is only very mildly corrupt. The header string that starts every .dtf file reads:

SYMANTEC TOUCHBASE DATABASE

After you ran XLookupSourceListAll on that file you will see that the first 12 bytes have been overwritten (% = denotes junk):

%%%%%%%%%%%%CHBASE DATABASE

If you use your favorite ASCII TEXT EDITOR (I am not aware of any microsoft product (including notepad, wordpad, or MSWord) that qualifies as an ASCII only editor) you can replace those bytes with "SYMANTEC TOU" and save the file (use a backup). That should restore your .dtf to its original state.

The corruption occured, not the first time the XLookupSourceListAll failed to open the file - but the subsequent attempts on the same run. The command does set the @error flag to indicate the failure, and writes a message to error log indicating that it does not recognize the file type.

I have fixed the bug that caused it to erroneously believe that the file had loaded. The fix will be in the next release. I will also notify the folks in charge of documentation to explicitly state which XLookup extension commands support Q&A files (or I will get the new commands to work on Q&A files for the next release).

I am personally sorry for the missunderstanding.

Please be aware that this does not affect XLookup, XLookupR, XUserSelect, XUserSelectR, and XListValues, which should work on any .dtf files without corruption.

Supports Q&A Files:
XLookup
@XLookup
XLookUpR
@XLookUpR
XUserSelect
@XUserSelect
XUserSelectR
@XUserSelectR
@XListValues

Only Supports Sesame Files:
XPost
XPostR
XPostAll
@XLookupAll
@XLookupSourceList
@XLookupSourceListAll
« Last Edit: Aug 16th, 2004 at 3:53pm by The Cow »  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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: How do I xlookup a Q&A dtf database?
Reply #13 - Aug 16th, 2004 at 3:15pm
Print Post Print Post  
I think this problem of corrupting Q&A files should have its own "sticky" subject at the top of the forum discussions.  This is not a problem of a function not working, but a problem of corrupting a file in another application.  Once the problem is repaired, it could be removed as a sticky.

This should also be sent to Tom Marcellus for inclusion in next issue of Inside Sesame.
===========================
Quote:
I will get the new commands to work on Q&A files for the next release).
Obviously that is the best solution for all.

But if any of the "X" family commands will not work with Q&A, I think that something must be done with Sesame to prevent damaging the Q&A file if someone forgets a particular command cannot be used.  Commmand processor needs to look at source database for ".dtf" extension and abort the process immediately, before it tries to open the file and corrupts it.

I don't want to get into discussion about if the Q&A file is "corrupted" or the header is modified.  End result is the user cannot use the Q&A database, and tech support of some nature will be required to repair it.  And if the cause is not known, then it will only repeat itself.

And thanks for info to repair the header.  As it happened, I had already used my backup copy to replace the damaged one.  But the instructions will go into the toolbox for future use (hopefully, never needed).
============================
Whispering:I have known of other software companies who do not admit problems until they have a patch available (which probably needs its own patch).  We certainly don't expect that from Lantica.  Lantica will tell us up front about problems that can be created even if a solution is not readily available.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
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: How do I xlookup a Q&A dtf database?
Reply #14 - Aug 16th, 2004 at 3:44pm
Print Post Print Post  
Just one more small clarification re XPost, XPostR.:

You list 6 commands in lower section that summarizes, Only Supports Sesame Files

But in the section near the top where you list 4 exception files:
Quote:
With the exception of XListValues, "X commands" that didn't exist in Q&A are not supported on Q&A databases. So:

XLookupAll
XLookupSourceList
XLookupSourceListAll
XPostAll

do not support Q&A .dtf files!

XPost and XPostR did exist in Q&A, but are not listed there. 

Doesn't that mean that they should be listed in the group that work in both Sesame and Q&A?  But they are shown in the group that does not work with Q&A.  This conflicts with the earlier statement.

So is the final summary at the bottom of the posting, Only Supports Sesame Files, the correct listing and the earlier comment was not correct?

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: How do I xlookup a Q&A dtf database?
Reply #15 - Aug 16th, 2004 at 3:50pm
Print Post Print Post  
A note about this will be added to the workarounds page. I will make sure that the documentation gets updated.

As to your advice on how to fix this. It isn't nearly so simple. We use centralized routines to access external databases. These routines are used by all of the "X Commands" and thus cannot differentiate the files by extension. Additionally, it is good practice to minimize the use of file extensions to differentiate file types, especially since we support OSs that do not necessarily use them outside of the HTML browser. So, in place, we use the file header embedded in the .db, .dat, .dsr. ddt files and the file name to match file types.

The bug itself was quite specific to the handful of commands that were added to extend XLookup, in that XLookup itself does not close a an open database until it is certain there will be no further XLookups. When you continued to call XLookupSourceListAll after it had returned a failure, it failed to mark that while that database file was open it had not successfully loaded.

The bug is now fixed. As I mentioned in my last post, the fix will be in the next release.

As a workaround, do not use the commands listed above on Q&A files. If you do, please make sure that you check both the @error (every time!) and check the log file for problems before you deploy on any data that you cannot easily replace. If an @error does occur, do not continue calling any of the extended "X Commands".

If you can't help yourself and do mess up a Q&A file. The repair for that file is trivial and outlined above. I only mentioned the fix because you described your file as "critical" and I wanted to make sure you understood that the file was easily recoverable and that there has been no loss of data or structure.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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: How do I xlookup a Q&A dtf database?
Reply #16 - Aug 16th, 2004 at 3:56pm
Print Post Print Post  
Thanks again Mark.

Also for reference about this issue:  Although there was a message in the log, I did not receive a message as a user, so there was no real visible indication to anyone that an error had occured.  Just wondering if those types of errors should be flagged visibily in addtion to being recorded in log.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: How do I xlookup a Q&A dtf database?
Reply #17 - Aug 16th, 2004 at 4:03pm
Print Post Print Post  
Quote:
Just one more small clarification re XPost, XPostR.:

You list 6 commands in lower section that summarizes, Only Supports Sesame Files

But in the section near the top where you list 4 exception files:
XPost and XPostR did exist in Q&A, but are not listed there.


The list at the top is specifically labelled as those X commands which did not exist in Q&A. As XPost and XPostR did exist in Q&A, they are not on that particular list. The list at the bottom lists all the X commands and which type of file they support regardless of where they originated. 

Quote:
Doesn't that mean that they should be listed in the group that work in both Sesame and Q&A?  But they are shown in the group that does not work with Q&A.  This conflicts with the earlier statement.

No, because they do not work with Q&A. Only those X commands that read were ever supported for Q&A files. XPost and XPostR write, and were never supported. See page 124 of the Programming Guide.

Quote:
So is the final summary at the bottom of the posting, Only Supports Sesame Files, the correct listing and the earlier comment was not correct?

Both are correct.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: How do I xlookup a Q&A dtf database?
Reply #18 - Aug 16th, 2004 at 4:08pm
Print Post Print Post  
Quote:
Thanks again Mark.

Also for reference about this issue:  Although there was a message in the log, I did not receive a message as a user, so there was no real visible indication to anyone that an error had occured.  Just wondering if those types of errors should be flagged visibily in addtion to being recorded in log.


We set @error for that purpose. The logged messages as generated by SBasic programming are intended for the programmers not the end-users. We give the programmers access to @error to encourage them to pass on any error message they may deem appropriate to their end-users without having to suppress the (usually technical) error messages their program may generate at runtime.

In other words, Sesame leaves it up to the programmer which errors they want to presented to the end user, and how they want them presented.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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: How do I xlookup a Q&A dtf database?
Reply #19 - Aug 16th, 2004 at 6:35pm
Print Post Print Post  
I can accept that, my problem, could have used an @error with message box.  But can you provide any guidelines about using that?  Certaily impractical to use it after every line of code.

I can see using it after every "X" type of command.
I can see using it after  every shell/macro commands.
I can see using it after  every I/O commands with files.

What about sub routines?. Do we use @error at the beginning or end of a subroutine, or pick and choose particular  lines within the subroutine? 
How about array processing?  Loops?

Can we use a generic error trapping routine on any Form Event to handle all code on that form?

Hoping you can provide some guidelines about what types of commands are more likely to generate messages?



  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: How do I xlookup a Q&A dtf database?
Reply #20 - Aug 16th, 2004 at 6:56pm
Print Post Print Post  
Use @error after any SBasic command where you would have your code do something different if the SBasic command fails.

@Error is only applicable to those SBasic commands that could be described as built in subroutines or functions. So SBasic statements do not affect @error, nor do variables, loops, and other control contructs.

I can't give you a list of the SBasic commands that log errors. Most of them do not themselves log errors, the engine or the user interface generates the logged error. Any command that accesses data (of any kind) or accesses the user interface (in any way) may generate a logged error. Most logged errors (that ever actually happen) are not nearly as serious as the conditions that cause @error. Many are merely informative. There are total of 884 of these messages that Sesame can generate. Most of them are static, built-in error messages. About 100 are dynamically produced errors.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged