Solved

How to show Master Detail fields in a single row in DBGrid

Posted on 1998-12-03
3
695 Views
Last Modified: 2010-04-04
Does anybody can show me an example
how I can show a master detail tables'
fields in one single row in DBGrid
using TTable component? They have one
to one relationship. I can't use the
TQuery component, because I have my
reason's.

Thanks.
0
Comment
Question by:davichoi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1349176
heh? use datasource... or what is your problem?


0
 

Expert Comment

by:elkiors
ID: 1349177
Like zif says, add a datasource for each of your table components. Next, in the DETAIL table component set the MASTERSOURCE property to the datasource of your MASTER table.

You will also need to add the linking field to MASTERFIELDS property and the corresponding Index to INDEXNAME both of which are in the Detail table component.

Warning, if the indexname is not an index on the linking field then the tables will not behave as a master/detail relationship

Darren
0
 

Accepted Solution

by:
forns earned 40 total points
ID: 1349178
hey, davichoi!
You need 2 TDataSources and 2 TTables not connected.
Take the fitst TTable and click on "Fields Editor..." it it's context menú. Click on "Add fields..." in the Fields Editor context menú. Add all the fields available. Right click on "New field..." in the Fields Editor context menú. Ok, what you've got to do now is adding fields assigning them a name and data type.
You can see a radio group named "Field type", choose "Lookup" and the "Lookup definition" radio group is now enabled. Now you've got to link the table your editing with the second table through their common fields and choose the fields of the second table you whant to see.
For example:
You've got a table like this [ID, Description, Size] for something and another table like [ID, price] for somethin's price, ok? If you whant to see the price in the DBGrid connected to the first Table, create a new field in the first table with this parameters:
Name: fldPrice
Component: (don't care)
Type: Integer (for example)
Size: (don't care)
Field type: lookup
Key fields: ID
Dataset: Table2
Lookup Keys: ID
Result field: price

And that's all. I hope it helps.
Anyway, it the natural way do define that 2 tables would be in just one with both's fields.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question