IT SOLUTIONS
Your TECHNOLOGY partner! 
-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
-Collapse +Expand Paradox Group Home
-Collapse +Expand Message Board
-Collapse +Expand Paradox KB
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Study Test
PRESTWOODCERTIFIED
-Collapse +Expand Paradox Store
PRESTWOODSTORE
-Collapse +Expand Members Only

Prestwood eMagazine

May Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyCorel Paradox / ObjectPAL Coding BoardObjectPAL Topic     Print This   

Running query removes a Key...?

Running query removes a Key...? in ObjectPAL topic (part of our Corel Paradox / ObjectPAL Coding group).

Quick Search: Running   removes   Running query   Running query removes   Key   

Lothar.K

Howdy,

I'm running Paradox 9 under Windows 7...

I have some code that adds the one record in a table (invoiceReplacedHold.db) to another table (invoicesReplaced.db). These tables have the same structure, and each is keyed on the first field (invNum.)

But, when I fire the code, the Source table (invoiceReplacedHold.db) loses its key...

Here's the code that deletes the key and the line that does the deed is marked:

qVar0 = Query

ANSWER: :MONEY:InvoiceReplacedHold.DB


:MONEY:INVOICES.DB  | InvNumber | Num    | Replaces | Replaced | Last   |
                    | Check ~S  | Check  | Check    | Check    | Check  |

:MONEY:INVOICES.DB  | First  | Adr    | Purpose | InvDate | DueDate | DUE    |
                    | Check  | Check  | Check   | Check   | Check   | Check  |

:MONEY:INVOICES.DB  | RECEIVED | Balance | Tag    | Comment | ReplaceNote |
                    | Check    | Check   | Check  | Check   | Check       |

EndQuery

if not executeQBE(qVar0) then errorshow() endif    ;/\/\/\/\/\ REMOVES KEY

sourceTbl = ":MONEY:InvoiceReplacedHold.DB"
destTbl = ":MONEY:InvoicesReplaced.db"

 if isTable(destTbl) then
  if not sourceTbl.add(destTbl) then
  errorShow()
  endIf
  else
  msgStop("Error", "Can't find " + destTbl + ".")
  endIf

I ran the code and got an "Incompatible Structures" error, looked at the structure of the two tables and saw that the source table was not keyed (though I felt sure it had been.) So I added the key, and saved the "new" structure. Then I ran the code again, only to get the same error.

I checked yet again, and the key that I had just replaced was gone again...

I put a breakpoint in at the top of the code (yes, there is more, but I have posted the lines that remove the key...)

Next, I checked one more time to see that the key was in place, and stepped through the code. After advancing one line, I looked for the key again. I thought it was going to take all night, but I very quickly found that the line that executes the query removes the key from invoiceReplacedHold.db.

Then, with the key gone, the two tables are indeed incompatable, and of course, my attempt to add the record fires the error.

I have no reason to believe that this is relevant, but...

This code had been working fine, until I needed to add a field to each of the tables. I did that, and made certain that the two tables were modified so as to preserve their identical structures. It was only after making that change that this problem started...

I am baffled, and so ask this question:

Why would running the query remove a table's key? And how can I prevent that from happening?

Very sincere thanks for any help,

Lothar

 Posted 19 months ago (Thread Starter)
Comment Quote
Location=?,  Joined=19 months ago   MB Posts=2  
More... -Collapse +Expand
Lothar.K
?
Rank: Cadet 2nd Year
Email A E Unk
Approved member.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #14700, 1 reply
Thread Started 10/14/2011 6:46:13 PM
View Counter=721
Most Recent Post

Lothar.K

Hello again,

I've continued to research this matter, and found a piece by Mike describing how to build the index witrh code.

I added these lines:

var
tblNoKeyTbl table
dynAttribs dynArray[] anyType
dynFieldNums dynArray[] smallInt
endVar

dynFieldNums[1] = 1
dynAttribs["Primary"] = True
tblNoKeyTbl.attach(":MONEY:InvoiceReplacedHold.DB")
tblNoKeyTbl.createIndex(dynAttribs,dynFieldNums);// PARAMETER MISMATCH

but I get the error as marked...

Thanks for any help,

Lothar

 Posted 19 months ago (Thread Starter)
Comment Quote
Location=?,  Joined=19 months ago   MB Posts=2  
More... -Collapse +Expand
Lothar.K
?
Rank: Cadet 2nd Year
Email A E Unk
Approved member.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #14701 (Level 2) and Parent is 14700
Reply Posted 10/15/2011 6:39:29 AM

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post:

Enter your name and security key.

Your Name:
Today's security key = P213A
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #14700 Counter
721
Since 10/14/2011
-
  Load Time=1 seconds.
 
Print This
-
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


651 People Online Now!!  
Online Now: Sign In to see who's online now!  Not a member? Join now. It's free!
Show More...


©1995-2013 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech