ActiveReports 18 .NET Edition
MESCIUS.ActiveReports Assembly / GrapeCity.ActiveReports.Data Namespace / XMLDataSource Class / RecordsetPattern Property
Example

In This Topic
    RecordsetPattern Property
    In This Topic

    Gets or sets a valid XPath pattern used to select the data source nodes to be printed in the report.

    Syntax
    'Declaration
     
    Public Property RecordsetPattern As String
    public string RecordsetPattern {get; set;}
    Remarks

    The report uses each node selected in the RecordSetPattern to create a detail section.

    Note: XSL patterns are case sensitive and must use valid XSL syntax. XSL and XPath documentation can be found on MSDN at https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms256172(v=vs.100)?redirectedfrom=MSDN and https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms256471(v=vs.100)?redirectedfrom=MSDN.

    Typical XSL patterns:

    Pattern                    Description

    //*                            All Nodes
    //ITEM                       All ITEM Nodes
    /                               Root item
    /LAYOUT/ITEM/*         All child nodes of /LAYOUT/ITEM
    //ITEM[@type]            All item nodes that contain the type attribute
    //ITEM[@id="1"]         All item nodes that have an id attribute value of "1"

    Example
    Paste into the Detail Format event.
    GrapeCity.ActiveReports.Data.XMLDataSource xDS = new GrapeCity.ActiveReports.Data.XMLDataSource();
    SectionReport1 rpt = new SectionReport1();
    
        xDS.ValidateOnParse = true;
        xDS.FileURL = System.Windows.Forms.Application.StartupPath + " \\customer.xml";
        xDS.RecordsetPattern = "//ITEM";
        xDS.NodeList = (System.Xml.XmlNodeList)ds.Field("ITEM",true);
        this.Label1.Text = xDS.CurrentPosition;
        Console.WriteLine(xDS.Count.ToString());
    
        if (xDS.BOF && xDS.EOF)
        {
            return;
        }
    Paste into the Detail Format event.
    Dim xDS As New GrapeCity.ActiveReports.Data.XMLDataSource()
    Dim rpt As New SectionReport1()
    
        xDS.ValidateOnParse = True
        xDS.FileURL = System.Windows.Forms.Application.StartupPath + " \\customer.xml"
        xDS.RecordsetPattern = "//ITEM"
        xDS.NodeList = xDS.Field("ITEM", True)
        Me.Label1.Text = xDS.CurrentPosition
        Console.WriteLine(xDS.Count.ToString())
    
        If xDS.BOF & xDS.EOF Then
            Exit Sub
        End If
    See Also