Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 1998-12-03
3
Medium Priority
?
739 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 80 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

Independent Software Vendors: 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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

722 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