Solved

Mutliple Datasources in DBGrid

Posted on 1998-02-28
8
301 Views
Last Modified: 2010-04-06
How can I gave multiple datasources in a single DBGrid?  I have a Master tables that has several details tables (5).  I want only certain coulmns from each detail table to appear in the grid.  How can I do this?

The solution given must allow a quick update of the DBGrid, so quering each detail table when the master record change is just too slow.

I will increase teh points if necessary.
0
Comment
Question by:d4jaj1
8 Comments
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
That was also something that I wanted to accomplish, but... I think it isn't that easy. I think a new component has to be made. I don't know yet how to solve this problem.
0
 

Expert Comment

by:jpussacq
Comment Utility
You can create a view in the Datab Base.
0
 

Expert Comment

by:bijoyn
Comment Utility
Hi ,

Well first of all u cannot assign mulitple datasources to one DBGrid. At any point of time the grid will talk to only one datasources. U can make it talk to multiple datasources one after the other but only one at a time.

Secondly how can u show data from more than one detail table in the same grid for a master record. In each of the five detail tables that u have u must be having one to many detail records for each master records right ?. Now if u read all the detail tables  at the same time then in one row of the grid how are u going to show the multiple values coming from the detail tables ?

U need to show the one to many relationships in more than one grid ( in your case 5 separate grids ). But if u still want to do what u are doing then there is a solution for it.

Tell me if u are interested. Send me your email address and I will send u an example.

Cheers,

Bijoy
0
 

Expert Comment

by:bijoyn
Comment Utility
Hi ,

Well first of all u cannot assign mulitple datasources to one DBGrid. At any point of time the grid will talk to only one datasources. U can make it talk to multiple datasources one after the other but only one at a time.

Secondly how can u show data from more than one detail table in the same grid for a master record. In each of the five detail tables that u have u must be having one to many detail records for each master records right ?. Now if u read all the detail tables  at the same time then in one row of the grid how are u going to show the multiple values coming from the detail tables ?

U need to show the one to many relationships in more than one grid ( in your case 5 separate grids ). But if u still want to do what u are doing then there is a solution for it.

Tell me if u are interested. Send me your email address and I will send u an example.

Cheers,

Bijoy
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 3

Author Comment

by:d4jaj1
Comment Utility
I was thinking of something like this.

Master Record  (Text boxes)
============================
Cust Name, Address, etc.

Detail Records (1 DB Grid)
===========================
  Detail Tables - Software, Certifications, etc.

      Software  |  Certifications  | Next DB Table
1     Word          MSIE
2     Delphi        PMI
3                   Experts Exchange
etc.


In the scenario above, each table name is a column heading and values from a specfic field in the table (software name, cert. name, etc) are inserted into the rows.  Notice I excluded other fields the teh detail table, like "Software Title ID".  The numbers on the left are simply the number of records each detail table has for that master record.

Thanks for all of the comments.  If anyone wants to send me an example or better solution -I'm all ears.  Email - 5429314@mcimail.com
0
 

Expert Comment

by:bijoyn
Comment Utility
I have sent u a mail with some explanation, hope u find it useful.

Bijoy
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
Is it possible to send me that explanation too? Tom.Deprez@uz.kuleuven.ac.be

Regards, Zif.
0
 
LVL 3

Accepted Solution

by:
KE earned 50 total points
Comment Utility
Hi there,

A late answer. You can add some calculated fields in the to the detail table, which get's their data from the master table.
Dbl-click your table component, and select New field. Adjust the new field, with the field editor, so it matches the master field your'e interested in- Write an OnCalc event-handler to the detail table, which does smth. like this:

DetailTable.FieldByName('MyNewField').AsString := MasterTable.FieldByName('MasterField').AsString;

The reason why you can't have to DataSources connected to a grid, is that it wouldn't know how to navigate your DataSet when requesting new rows etc.

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
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.

743 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

16 Experts available now in Live!

Get 1:1 Help Now