combit List & Label 29 - .NET Help
combit.Reporting.DataProviders Namespace / ITableRow Interface / GetParentRow Method
The relation to the parent table.
Example


In This Topic
    GetParentRow Method
    In This Topic
    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 10 (Version 21H2 - 23H2), Windows 11 (21H2 - 22H2), Windows Server 2016 - 2022
    .NET: .NET Framework 4.8, .NET 6, .NET 7, .NET 8

    See Also