Virtual Join using ParentRow

  • Thread starter Thread starter Masahiro Ito
  • Start date Start date
M

Masahiro Ito

I read somewhere about doing a virtual join on a table by adding a row that
computes the parentrow's value.

I can't seem to get the syntax down. Using an Orders and a Customers table
as an example:

dsOrders1.Orders.Columns.Add("CustomerName", ?, ?)

The 'Type' of the row should be string? I tried various ways to do a
GetType on the Customers table column that I need ("Name"), but it doesn't
seem to work?

Then the expression - I assume it is some variation of
DSOrders1.Orders(m_currencymanager.Position).GetParentRow
("CustomersOrders")

Can anyone help me?

Thank you.

Masa
 
Hi Masahiro,

dsOrders1.Orders.Columns.Add("CustomerName",
System.Type.GetType("System.String"), "Parent.Name")
This kind of expression will work while table child has only one parent.
Otherwise you have to specify the relation within brackets.
See DataColumn.Expression .net help topic.
 
Miha Markic said:
dsOrders1.Orders.Columns.Add("CustomerName",
System.Type.GetType("System.String"), "Parent.Name")
This kind of expression will work while table child has only one parent.
Otherwise you have to specify the relation within brackets.
See DataColumn.Expression .net help topic.

Thank you. This code seems to work great when there is only one
datarelation?

I have multiple datarelations, and get an error when using this syntax. Is
there a way to identify the specific datarelation?

I have tried:
....System.Type.GetType("System.String"), "Parent.Name")
....System.Type.GetType("System.String"), "CustomersOrders.Name")

Masa
 
Thank you. This code seems to work great when there is only one
datarelation?

I have multiple datarelations, and get an error when using this
syntax. Is there a way to identify the specific datarelation?

I have tried:
...System.Type.GetType("System.String"), "Parent.Name")
...System.Type.GetType("System.String"), "CustomersOrders.Name")

Masa

Miha,

Thanks for your help. I found the answer to my question (thanks to the
reference to the help file you provided).

In case anyone else is following:

GetType(System.String), "Parent(CustomersOrders).Name")

worked great.

Masa
 
Back
Top