TS. Table Reports


In the Table Report, configure a list of records (fields) that will represent a number of columns containing the schedule data.

Use Table Reports to create and export a CSV file containing custom header names to match a specified format.

 

 

 

Adding Table Report

Table type reports can be added by choosing “Table Report” option from Add Report dropdown.

Once added, a blue icon with a table and the name “New Table Report” will appear in the list of reports. Rename it clearly.

New Table Report in the list of project reports

Configuring Table Report

The Table Reports consists of two interconnecting tabs: Setup and Result. In the Setup tab you can add and give an export caption the Data Fields required to be displays in the Result tab.

  1. In the Data Field column add fields you want to report on.

    1. Use the dropdown menu provided in each row to find a field required, or

    2. Drag and drop fields available in the Fields panel.

  • Use the Search tool to simplify searching for the fields to be reported on.

  • Empty rows in the Data Field column are not critical, they will not be present in the Result and Export (unless have an Export Caption specified).

2. In the Export Caption column, edit the field captions to be displayed as Header names in the Result tab and in the exported report.

  • Export captions cannot duplicate, otherwise you’ll get an error message, preventing you from moving to the Result tab.

    • Rows containing duplicated names will be marked with a red circle, as shown below:

Applying filters to the Table Report

It is possible to apply a filter to a Table Report. The filter can be created in the code editor that appears when the “Use Filter” check box is toggled on.

Use simple “If” statement to specify what to include in the result, if a specified condition is true. See the examples below.

Available Formulas

Two formula helpers are located at the bottom of the editor, which assists in retrieving values used in the filter logic.

  • In the Available Formulas panel double click on TableFilterContextN or TableFilterContextT to configure and return the value in the current row as a number or text.

Filtering on Destination example

To filter on a specific destination, use the following sample code:

using System; using System.Collections.Generic; using System.Text; using System.Linq; using Alastri.Scripting; using System.ComponentModel; using Alastri.UI.Reports.Table; public class MyTableFilter : ITableFilter { public bool Include(in TableFilterContext context) { if(context.T("DestinationFullName").Equals("Stockpiles/HG1_ROM/WtAvg")) { return true; } return false; } }

The code on the left will filter the destinations available by the specified name, ie, only “Stockpiles/HG1_ROM/WtAvg” will be included in the result.



using System; using System.Collections.Generic; using System.Text; using System.Linq; using Alastri.Scripting; using System.ComponentModel; using Alastri.UI.Reports.Table; public class MyTableFilter : ITableFilter { public bool Include(in TableFilterContext context) { if(context.T("DestinationFullName").Contains("Stockpiles")) { return true; } return false; } }

The code on the left will filter the destinations available by any containing “Stockpiles” in the name.

 

Filtering on Source example

To filter on a specific source, use the following sample code:

using System; using System.Collections.Generic; using System.Text; using System.Linq; using Alastri.Scripting; using System.ComponentModel; using Alastri.UI.Reports.Table; public class MyTableFilter : ITableFilter { public bool Include(in TableFilterContext context) { if(context.T("SourceFullName").Equals("OpenPit/Mine/Pit1/Stage1/790/1/790")) { return true; } return false; } }

The code on the left will filter the sources available by the specified name, ie, only “OpenPit/Mine/Pit1/Stage1/790/1/790” will be included in the result.

See the notes above.


Filtering on Agent example

To filter on a specific Agent/Agent type, use the following sample code:

The code on the left will filter the agents by the specified group, ie, only “R9400” will be included in the result.

 

See the notes above.


Filtering on Source AND Destination example

To filter on a specific Source and Destination, use “&&” logical operator, like shown in the sample code below:

The code on the left will filter the sources and the destinations available by the specified names, ie, only transactions between “Stockpiles/HG1_ROM/WtAvg” and “OpenPit/Mine/Pit“ will be included in the result.

 

See the notes above.


  • Depending on your C# knowledge level, you might try to code more complex filtering.

    • For your reference, see below the list of most commonly used logical operators.

And

&&

If A is "true" and B is "true" and C is "true", then return "true", else return "false"

Or

||

If A is "true" or B is "true" or C is "true", then return "true", else return "false"

Equal to

==

If A is equal to B, return "true", else return "false"

Not equal to

!=

If A is not equal to B, return "true", else return "false"

Greater than

>

If A is greater than B, return "true", else return "false"

Greater than or equal to

>=

If A is greater than or equal to B, return "true", else return "false"

Less than

<

If A is less than B, return "true", else return "false"

Less than or equal to

<=

If A is less than or equal to B, return "true", else return "false"

Errors

Observe the error messages appearing dynamically in the Errors panel, if any. Resolve all the errors to proceed to the result.

Check if the statement is correct by pressing the Compile button at the top left corner of the Script Editor.

If you made a mistake, the Compile Error window will pop up, showing row and column of an error with a short description of its type.

When the Errors panel is blank, and all data fields are mapped, proceed to the Result tab.

Exporting

Export the generated report with your custom data fields and headers as a CSV file using the Export Selected button.