combit List & Label 25 - .NET Online Web Help
GetParentRow Method
Example 


combit.ListLabel25.DataProviders Namespace > ITableRow Interface : GetParentRow Method
The relation to the parent table.
This method is called to access the fields of a parent table. Within the Designer, these fields are made available in a folder with a "1:1" icon.  If your provider does not support 1:1 relations, simply return false for the SupportsGetParentRow property and throw a NotImplementedException for this method. Be aware however that your users will not be able to access e.g. customer data from an order if you have a 1:n relation between customers and their orders.
Syntax
'Declaration
 
Function GetParentRow( _
   ByVal relation As ITableRelation _
) As ITableRow

Parameters

relation
The relation to the parent table.
Example
public ITableRow GetParentRow(ITableRelation relation)
{
    DataViewManager manager = _dataRowView.DataView.DataViewManager;
    DataView parentView = manager.CreateDataView(manager.DataSet.Tables[relation.ParentTableName]);
    String childValue = _dataRowView[relation.ChildColumnName].ToString();

    // apply row filter
    parentView.RowFilter = relation.ParentColumnName + "='" + childValue + "'";
    DataRowViewWrapper wrapper = new DataRowViewWrapper(parentView[0]);
    return wrapper;
}
Public Function GetParentRow(relation As ITableRelation) As ITableRow
    Dim manager As DataViewManager = _dataRowView.DataView.DataViewManager
    Dim parentView As DataView = manager.CreateDataView(manager.DataSet.Tables(relation.ParentTableName))
    Dim childValue As [String] = _dataRowView(relation.ChildColumnName).ToString()

    ' apply row filter 
    parentView.RowFilter = relation.ParentColumnName + "='" + childValue + "'"
    Dim wrapper As New DataRowViewWrapper(parentView(0))
    Return wrapper
End Function
Requirements

Platforms: Windows 7 SP1 - Windows 10 Version 1909, Windows Server 2008 R2 - 2019

See Also

Reference

ITableRow Interface
ITableRow Members