Solved

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

Posted on 1998-12-03
3
632 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
3 Comments
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
heh? use datasource... or what is your problem?


0
 

Expert Comment

by:elkiors
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now