Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 6 of 6 total |
Master Detail issue |
Thu, May 8 2008 11:11 AM | Permanent Link |
Alfred Ghazzi | Hi Tim
I'm having a problem with a master detail tables.. I'm using the latest build which is 1.9 build 3 <sample> Table 1 (master) Field F1 (integer) Field F2 (string) primary index is on F1 records 1, 'A' 1, 'B' 1, 'C' 2, 'A' 3, 'B' 3, 'C' Table 2 (detail) Field F3 (string) Field F4 (whatever) primary index is on F3 records 'A',... 'B',... 'C',... The link should be between F3 (In detail) pointing to F2 (in master) set Table2's mastersource to datasource1 which has dataset set to Table1 masterfields set to F2 Now I set range on Table1 --> Table1.setrange([1], [1]) I should expect Table2 with 3 records, it returns 1 only Now I set range on Table1 --> Table1.setrange([3], [3]) I should expect Table2 with 2 records, it returns 1 only I'm not sure whether this is a bug or I'm doing somthing wrong Please, the earliest advice would be very appriciated. since I lost a lot of time to figure where the problem is and the deadline already passed by 5 days with unhappy client... Many thanks Alfred Ghazzi |
Thu, May 8 2008 11:35 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Alfred
You're doing something wrong I think you're misunderstanding master-detail relationships. Using your data, you set the range for table1 to [1],[1] which results in three records being shown. i) 1, 'A' ii) 1, 'B' iii) 1, 'C' Whilst record i) is the current record the m-d relationship will result in table2 ONLY showing records which satisfy that relationship ie 'A',... Think in terms of each time you move the cursor in table1 that results in a range being set on table2 such that the relationship F2 on the master = F3 on the detail table. Hence, with the data you posted, I would never expect more than one record being shown in table2 Roy Lambert [Team Elevate] |
Thu, May 8 2008 11:35 AM | Permanent Link |
Uli Becker | Alfred,
it is not clear which indexes you use to join the two tables. I don't see an integer based index in your detail table which could be joined to the field F1 of the master table. The scenario should be like this: Table 1 (master) Field F1 (integer) Field F2 (string) primary index is on F1 Table 1 (detail) Field F1 (integer) Field F2 (integer) Field F3 (string) primary index is on F1, foreign key on F2 Now you join master.F1 -> detail.F2 Or did I completely misunderstand the whole thing? Uli |
Thu, May 8 2008 9:33 PM | Permanent Link |
Alfred Ghazzi | Alfred Ghazzi <alfred@maxiworks.com> wrote:
First I want to thank both of you (Roy and Uli) for your kind support... The issue is that I want to make Table2 show in a grid all the records where F1 in Table1 = 1 (for example) . I was hoping that by setting the range on F1 of Table1 I get a set of records where F2 is used to tell Table2 what records to show based on F3 = F2. The situation I have is many-to-many relationship and in this example Table1 is the relationship table and Table0 (not included in the example) and Table2 contain the data. Many thanks Alfred Ghazzi |
Thu, May 8 2008 9:52 PM | Permanent Link |
Alfred Ghazzi | Hi Roy and Uli
You are right Roy. I just relized it... Is there a way to acheive my goal per my second posting... Any help will be appriciated... Many thanks Alfred Ghazzi |
Thu, May 8 2008 10:12 PM | Permanent Link |
Alfred Ghazzi | Hi Roy and Uli
After being very confused (very few sleeping hours) and realizing my error, I found the solution through SQL Query SELECT * FROM Table2 WHERE F3 IN (SELECT F2 FROM Table1 WHERE F1 = 1) Bingo.... Done Thank you very much for your support.... Alfred Ghazzi |
This web page was last updated on Sunday, May 19, 2024 at 08:46 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |