Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
CreateTable.cs
2using System.Threading.Tasks;
3using System.Xml;
6
8{
13 {
14 private readonly ReportStringAttribute tableId;
15 private readonly ReportStringAttribute name;
16 private readonly TableColumn[] columns;
17 private readonly int nrColumns;
18
24 public CreateTable(XmlElement Xml, ReportFile Report)
25 : base(Report)
26 {
27 this.tableId = new ReportStringAttribute(Xml, "tableId");
28 this.name = new ReportStringAttribute(Xml, "name");
29
30 List<TableColumn> TableColumns = new List<TableColumn>();
31
32 foreach (XmlNode N in Xml.ChildNodes)
33 {
34 if (N is XmlElement E && E.LocalName == "Column")
35 TableColumns.Add(new TableColumn(E));
36 }
37
38 this.columns = TableColumns.ToArray();
39 this.nrColumns = this.columns.Length;
40 }
41
47 public override async Task<bool> Execute(ReportState State)
48 {
49 string TableId = await this.tableId.Evaluate(State.Variables);
50 string Name = await this.name.Evaluate(State.Variables);
51
52 Column[] Columns = new Column[this.nrColumns];
53 int i;
54
55 for (i = 0; i < this.nrColumns; i++)
56 Columns[i] = await this.columns[i].Evaluate(State);
57
58 await State.Query.NewTable(TableId, Name, Columns);
59
60 return true;
61 }
62 }
63}
override async Task< bool > Execute(ReportState State)
Executes the report action.
Definition: CreateTable.cs:47
CreateTable(XmlElement Xml, ReportFile Report)
Creates a table in the report
Definition: CreateTable.cs:24
Abstract base class for report actions.
Definition: ReportAction.cs:9
ReportFile Report
Parsed report containing the report action.
Definition: ReportAction.cs:24
Contains a parsed report, as defined in a report file.
Definition: ReportFile.cs:23
Class containing the state of a report.
Definition: ReportState.cs:12
Variables Variables
Current set of variables.
Definition: ReportState.cs:55
Query Query
Current query object reference.
Definition: ReportState.cs:35
Defines a column in a table.
Definition: Column.cs:30
Task NewTable(string TableId, string TableName, params Column[] Columns)
Defines a new table in the query output.
Definition: Query.cs:272