Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / ReportData Structure
Members Example
In This Topic
    ReportData Structure
    In This Topic
    Contains Report table data.
    Object Model
    ReportData StructureProperty Class
    Inheritance Hierarchy

    System.Object
       System.ValueType
          EPLAN.Harness.API.Projects.Documents.ReportData

    Syntax
    [DefaultMember("Item")]
    public struct ReportData : System.ValueType 
    Example
    // Open the report.
    report.Open(false, false);
    
    // Get a report data. This action is slow as the object with all the data is constructed each time the property is accessed.
    // Note that we get ReportData object once and then use it for all the queries.
    ReportData reportTable = report.Data;
    
    // You can simply get the report dimensions. Please note that unused columns are also included.
    Console.WriteLine($"The report has {reportTable.ColumnCount} columns and {reportTable.RowCount} rows.");
    
    // Print all the used columns names.
    //Console.Write("Report has following used columns: ");
    Console.WriteLine("Report has following used columns: ");
    foreach (ColumnDescription column in reportTable.Columns)
    {
    	// Print only used columns.
    	if (column.Used)
    		Console.Write($"{column.Name}; ");
    }
    Console.WriteLine();
    
    // Pick a column with a name "Length".
    ColumnDescription lengthColumn = reportTable.Columns.Where(n => n.Name == "Length").FirstOrDefault();
    
    // Print the whole column:
    Console.WriteLine("Length column:");
    for (int i = 0; i < reportTable.RowCount; i++)
    {
    	// You can use ColumnDescription for indexing.
    	Property value = reportTable[i, lengthColumn];
    	
    	// Empty fields are set to null.
    	if (value != null)
    		Console.Write($"{value.ToString()}; ");
    	else
    		Console.Write("<empty>; ");
    }
    Console.WriteLine();
    
    // Print the first row:
    Console.WriteLine("First row:");
    for (int i = 0; i < reportTable.ColumnCount; i++)
    {
    	// You can use coordinates for indexing. Note that unused columns are also present in the table.
    	Property value = reportTable[0, i];
    	
    	// Empty fields are set to null.
    	if (value != null)
    		Console.Write($"{value.ToString()}; ");
    	else
    		Console.Write("<empty>; ");
    }
    Console.WriteLine();
    
    // WRONG! Constructing whole table when accessing each field in a row.
    //for (int i = 0; i < reportTable.ColumnCount; i++)
    //{
    //    // You can use coordinates for indexing.
    //    Property value = report.Data[0, i]; // <<< SLOW! Getter of the Data property constructs the whole table!
    //    // Empty fields are set to null.
    //    if (value != null)
    //        _context.ConsoleOutput(value.ToString());
    //}
    
    // Close the report.
    report.Close();
    Public Properties
     NameDescription
    Public Property Number of columns in the table.  
    Public Property Get list of columns.  
    Public PropertyOverloaded.  Access a field in a table.  
    Public Property Number of rows in the table.  
    Top
    See Also