If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Corel Paradox > Create composite key in answer table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-17-04, 17:40
daverj daverj is offline
Registered User
 
Join Date: Jan 2004
Posts: 21
Create composite key in answer table

I need to create a report based on some regular tables in my DB and a couple of answer tables that are created by running queries just before running the report. I made the queries in the standard QBE mode but can't figure out any way to get it to make fields in the answer table to be keys. I want a composite key made from the first two fields in the answer table.

Of course I can go and restructure the answer table after running the query, and add the keys, but that is no good. I need to automate this so the answer table is generated and then used in the report.

Is there any way to tell QBE to make an answer table field be a key?
Reply With Quote
  #2 (permalink)  
Old 12-21-04, 15:40
Maroonotmoron Maroonotmoron is offline
Registered User
 
Join Date: Sep 2003
Location: Dallas
Posts: 182
I know of only two ways to do it

The first way is to create a script and automate the process. The script will of course go in and restructure the table.

The second way (easier) is to use an append query and create the table permanently first. "Report_Table" Then create a query that does not create an answer table but inserts records into the report table. Which will already be keyed.

By the way, do you know that you can create the report based on the Query instead of the answer table which would allow you some other flexibility?
Reply With Quote
  #3 (permalink)  
Old 12-22-04, 20:29
daverj daverj is offline
Registered User
 
Join Date: Jan 2004
Posts: 21
Thanks. That sent me in the right direction for what I needed. I read up on doing queries with delete and insert and ended up running 2 queries to build up the results I needed and then a query to delete the current contents of the final table and another query to insert the new data into the final table.

There may have been an easier way to do it, but I got that done in an hour and I had spent days banging my head against the wall before posting the original message, so for me it was a quick fix. I couldn't get the insert to work directly from the first pair of queries because there were a number of calculated fields and Paradox wouldn't let me do inserts with "calc" in them.
Reply With Quote
  #4 (permalink)  
Old 12-27-04, 11:59
Maroonotmoron Maroonotmoron is offline
Registered User
 
Join Date: Sep 2003
Location: Dallas
Posts: 182
Well some help is better than none :-)

By the way did you know that you can save the queries and then play them sequentially in a script which will still automate the process with a one button approach?
Reply With Quote
  #5 (permalink)  
Old 12-27-04, 17:00
daverj daverj is offline
Registered User
 
Join Date: Jan 2004
Posts: 21
Yes. That's what I was doing. I have a button that when pressed runs each query, one after the other, and then opens the report.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On