Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
TableRecords.cs
2using System.Threading.Tasks;
3using System.Xml;
6
8{
13 {
14 private readonly ReportStringAttribute tableId;
15 private readonly TableRecord[] records;
16 private readonly int nrRecords;
17
23 public TableRecords(XmlElement Xml, ReportFile Report)
24 : base(Report)
25 {
26 this.tableId = new ReportStringAttribute(Xml, "tableId");
27
28 List<TableRecord> TableRecords = new List<TableRecord>();
29
30 foreach (XmlNode N in Xml.ChildNodes)
31 {
32 if (N is XmlElement E && E.LocalName == "Record")
33 TableRecords.Add(new TableRecord(E));
34 }
35
36 this.records = TableRecords.ToArray();
37 this.nrRecords = this.records.Length;
38 }
39
45 public override async Task<bool> Execute(ReportState State)
46 {
47 string TableId = await this.tableId.Evaluate(State.Variables);
48 Record[] Records = new Record[this.nrRecords];
49 int i;
50
51 for (i=0;i<this.nrRecords;i++)
52 Records[i] = new Record(await this.records[i].Evaluate(State));
53
54 await State.Query.NewRecords(TableId, Records);
55
56 return true;
57 }
58 }
59}
TableRecords(XmlElement Xml, ReportFile Report)
Reports records to a table.
Definition: TableRecords.cs:23
override async Task< bool > Execute(ReportState State)
Executes the report action.
Definition: TableRecords.cs:45
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
Task NewRecords(string TableId, params Record[] Records)
Reports a new set of records in a table.
Definition: Query.cs:300
Defines a record in a table.
Definition: Record.cs:9