dbTalk Databases Forums  

Help with Paradox 9 table schema

comp.databases.paradox comp.databases.paradox


Discuss Help with Paradox 9 table schema in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dwightarmyofchampions@hotmail.com
 
Posts: n/a

Default Help with Paradox 9 table schema - 08-17-2008 , 05:12 PM






I'm a total newbie to Paradox and I need some help creating my
database tables. I work with Paradox 9 through Borland C++ Builder
2006. I want to have two database tables, one called Transactions and
another called TransactionDetails. Transactions has primary key
TransactionID, which is an ftString. TransactionDetails has a primary
key (TransactionID, TransactionAccountType) and both are strings.

Now, I want to make TransactionDetails be a child of Transactions so
that:

1. I cannot add a record to Transactions without first adding it to
TransactionDetails.
2. When I update a record in the Transactions table, the corresponding
record in TransactionDetails (i.e. the records with the same
TransactionID number) will also be updated. For example, if I go into
Transactions and change a record's TransactionID number from 1111 to
2222, it will automatically search in TransactionDetails for all
records that have a TransactionID number of 1111 and change those to
2222 automatically.

How do I form these two tables?

As it is now, I have C++ code that creates the two tables:

////////// CODE BEGINS HERE //////////

// create parent table
TTable* taTransactions = new TTable(this);
taTransactions->DatabaseName = "C:\\temp";
taTransactions->TableType = ttParadox;
taTransactions->TableName = "Transactions.db";
taTransactions->FieldDefs->Clear();
taTransactions->FieldDefs->Add("TransactionID", ftString, 10, true);
taTransactions->FieldDefs->Add("TransactionDate", ftDateTime, 0,
true);
taTransactions->FieldDefs->Add("TotalAmount", ftCurrency, 0, true);
taTransactions->IndexDefs->Clear();
taTransactions->IndexDefs->Add("", "TransactionID",
TIndexOptions()<<ixPrimary);

// create child table
TTable* taTransactionDetails = new TTable(this);
taTransactionDetails->DatabaseName = "C:\\temp";
taTransactionDetails->TableType = ttParadox;
taTransactionDetails->TableName = "TransactionDetails.db";
taTransactionDetails->FieldDefs->Clear();
taTransactionDetails->FieldDefs->Add("TransactionID", ftString, 10,
true);
taTransactionDetails->FieldDefs->Add("TransactionAccountType",
ftString, 5, true);
taTransactionDetails->FieldDefs->Add("TransactionType", ftString, 5,
true);
taTransactionDetails->FieldDefs->Add("AmountReceived", ftCurrency, 0,
true);
taTransactionDetails->FieldDefs->Add("AmountDisbursed", ftCurrency, 0,
true);
taTransactionDetails->FieldDefs->Add("AccountNumber", ftString, 8,
true);
taTransactionDetails->FieldDefs->Add("PersonID", ftString, 10, true);
taTransactionDetails->FieldDefs->Add("Percent", ftFloat, 0, true);
taTransactionDetails->IndexDefs->Clear();
taTransactionDetails->IndexDefs->Add("",
"TransactionID;TransactionAccountType", TIndexOptions()<<ixPrimary);

taTransactions->CreateTable();
taTransactionDetails->CreateTable();

// delete pointers
delete taTransactions; taTransactions = 0;
delete taTransactionDetails; taTransactionDetails = 0;

////////// CODE ENDS HERE //////////

Problem is I don't quite have it yet. There's no "link" between
Transactions and TransactionDetails. I know there's a much MUCH easier
way to do this via the Paradox 9 program instead of C++.
Unfortunately, I don't really know how to use that. Can anybody help
me?

Reply With Quote
  #2  
Old   
Tony McGuire
 
Posts: n/a

Default Re: Help with Paradox 9 table schema - 08-17-2008 , 05:22 PM







This appears to be a C++ question, rather than a Paradox question.
Althogh you mention 'Paradox 9' (?).

While someone may be able to help you here, you may be better served
asking this on a C++ forum.

Quote:
way to do this via the Paradox 9 program instead of C++.
Unfortunately, I don't really know how to use that. Can anybody help
me?
Well, getting a C++ answer will be a LOT easier than starting from
scratch with Paradox the Application.


--
------------------------------
Tony McGuire




Reply With Quote
  #3  
Old   
Tony McGuire
 
Posts: n/a

Default Re: Help with Paradox 9 table schema - 08-17-2008 , 05:22 PM




This appears to be a C++ question, rather than a Paradox question.
Althogh you mention 'Paradox 9' (?).

While someone may be able to help you here, you may be better served
asking this on a C++ forum.

Quote:
way to do this via the Paradox 9 program instead of C++.
Unfortunately, I don't really know how to use that. Can anybody help
me?
Well, getting a C++ answer will be a LOT easier than starting from
scratch with Paradox the Application.


--
------------------------------
Tony McGuire




Reply With Quote
  #4  
Old   
Tony McGuire
 
Posts: n/a

Default Re: Help with Paradox 9 table schema - 08-17-2008 , 05:22 PM




This appears to be a C++ question, rather than a Paradox question.
Althogh you mention 'Paradox 9' (?).

While someone may be able to help you here, you may be better served
asking this on a C++ forum.

Quote:
way to do this via the Paradox 9 program instead of C++.
Unfortunately, I don't really know how to use that. Can anybody help
me?
Well, getting a C++ answer will be a LOT easier than starting from
scratch with Paradox the Application.


--
------------------------------
Tony McGuire




Reply With Quote
  #5  
Old   
Tony McGuire
 
Posts: n/a

Default Re: Help with Paradox 9 table schema - 08-17-2008 , 05:22 PM




This appears to be a C++ question, rather than a Paradox question.
Althogh you mention 'Paradox 9' (?).

While someone may be able to help you here, you may be better served
asking this on a C++ forum.

Quote:
way to do this via the Paradox 9 program instead of C++.
Unfortunately, I don't really know how to use that. Can anybody help
me?
Well, getting a C++ answer will be a LOT easier than starting from
scratch with Paradox the Application.


--
------------------------------
Tony McGuire




Reply With Quote
  #6  
Old   
Tony McGuire
 
Posts: n/a

Default Re: Help with Paradox 9 table schema - 08-17-2008 , 05:22 PM




This appears to be a C++ question, rather than a Paradox question.
Althogh you mention 'Paradox 9' (?).

While someone may be able to help you here, you may be better served
asking this on a C++ forum.

Quote:
way to do this via the Paradox 9 program instead of C++.
Unfortunately, I don't really know how to use that. Can anybody help
me?
Well, getting a C++ answer will be a LOT easier than starting from
scratch with Paradox the Application.


--
------------------------------
Tony McGuire




Reply With Quote
  #7  
Old   
Tony McGuire
 
Posts: n/a

Default Re: Help with Paradox 9 table schema - 08-17-2008 , 05:22 PM




This appears to be a C++ question, rather than a Paradox question.
Althogh you mention 'Paradox 9' (?).

While someone may be able to help you here, you may be better served
asking this on a C++ forum.

Quote:
way to do this via the Paradox 9 program instead of C++.
Unfortunately, I don't really know how to use that. Can anybody help
me?
Well, getting a C++ answer will be a LOT easier than starting from
scratch with Paradox the Application.


--
------------------------------
Tony McGuire




Reply With Quote
  #8  
Old   
Tony McGuire
 
Posts: n/a

Default Re: Help with Paradox 9 table schema - 08-17-2008 , 05:22 PM




This appears to be a C++ question, rather than a Paradox question.
Althogh you mention 'Paradox 9' (?).

While someone may be able to help you here, you may be better served
asking this on a C++ forum.

Quote:
way to do this via the Paradox 9 program instead of C++.
Unfortunately, I don't really know how to use that. Can anybody help
me?
Well, getting a C++ answer will be a LOT easier than starting from
scratch with Paradox the Application.


--
------------------------------
Tony McGuire




Reply With Quote
  #9  
Old   
Steven Green
 
Posts: n/a

Default Re: Help with Paradox 9 table schema - 08-17-2008 , 05:31 PM



as Tonty said, these are C+ questions.. the table format isn't the issue,
it's the platform you use.. always ask questions to the people using your
native platform..

however, your game-plan has flaws, no matter what platform:


Quote:
so that I cannot add a record to Transactions without first adding it to
TransactionDetails.
that's backwards, but I think this was a typo.. if not, it's definitely
problematic.. you *always* create the master first..


Quote:
2. When I update a record in the Transactions table, the corresponding
record in TransactionDetails (i.e. the records with the same TransactionID
number) will also be updated.
serious design flaw here.. the primary key should never change.. its either
a sequential value, or a system-generated value.. it's not user-defined,
and should *never* change..

--
Steven Green - Myrtle Beach, South Carolina USA

Diamond Software Group
http://www.diamondsg.com/main.htm
Paradox Support & Sales

Diamond Sports Gems
http://www.diamondsg.com/gemsmain.htm
Sports Memorabilia and Trading Cards




Reply With Quote
  #10  
Old   
Steven Green
 
Posts: n/a

Default Re: Help with Paradox 9 table schema - 08-17-2008 , 05:31 PM



as Tonty said, these are C+ questions.. the table format isn't the issue,
it's the platform you use.. always ask questions to the people using your
native platform..

however, your game-plan has flaws, no matter what platform:


Quote:
so that I cannot add a record to Transactions without first adding it to
TransactionDetails.
that's backwards, but I think this was a typo.. if not, it's definitely
problematic.. you *always* create the master first..


Quote:
2. When I update a record in the Transactions table, the corresponding
record in TransactionDetails (i.e. the records with the same TransactionID
number) will also be updated.
serious design flaw here.. the primary key should never change.. its either
a sequential value, or a system-generated value.. it's not user-defined,
and should *never* change..

--
Steven Green - Myrtle Beach, South Carolina USA

Diamond Software Group
http://www.diamondsg.com/main.htm
Paradox Support & Sales

Diamond Sports Gems
http://www.diamondsg.com/gemsmain.htm
Sports Memorabilia and Trading Cards




Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.