Forum Moderators: open

Message Too Old, No Replies

Working with Datarelation

Working with Datarelation

         

hkpanda

2:49 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



Hi,

I am three different tables which I'm joining thru different datarelations (all in one dataset).

Now, what I want is to sort a table (any one) based on columns in other tables. E.g. if table1 has a particular column sorted, then I want something like table2.sort=<column from table1>.

Do I have to create a 4th table? If yes, then how?

Also, can I do this without creating a 4th table?

Thanks in advance.

RossWal

4:45 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



I'm pretty new to using data relations so take this for what it's worth. It sounds to me like the column you refer to in table 1 is a foreign key into table 2, no? If so, as you navigate the child rows in table 2 you will only have one distinct instance of the the foreign key from table 1, so sorting should be unneccessary.

Am I missing the point?

Ross

hkpanda

5:16 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



I'm afraid you missed it completely.

The column in table1 has got absolutely no relation with that of table2 or table3. In fact, all the tables are linked by a single id field (you can assume this id to be pk in any one table, and fk in rest of the tables).

sorting affects the way this id field is rearranged and I want the same rearrangement in rest of the tables.

hkpanda

RossWal

11:30 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



Sorry. I'm still not getting it. When table1 gets sorted, the child rows in t2-3 for each row in table1 should automatically follow their parent. Are there additional columns in t2-3 that require a further sort?

hkpanda

6:38 am on Aug 7, 2003 (gmt 0)

10+ Year Member



Hey, I think you raised a good point regarding this automatic sorting of child rows. But I think I'll brief you about what really happens inside.

When you sort a table in .Net, you do it using a dataview. What dataview does is creates an in-memory representation of sorted recordset; no actual sorting is applied on table. In fact you can see unsorted and sorted rows both at the sametime using the same dataview (by using rowstatefilter property).

The limitatiom is dataview can be sorted based on columns of the base table (of which the dataview is created) and not on any other tables (even if joined via relations).

Still feel like digging into it?