Update cookies preferences
Promotic

Filling the PmgWTable object with values obtained by the panel method from the application.

The example initializes the table in the InitTable method and names the columns in the header.
The "FillTable" method gets an array of values using the designer method GetDataTable, to populate its contents.
The "InitTable" method is located on the "Methods" tab and is triggered in the onStart event of the PmgWTable object.
There is also the "FillTable" method, which will run in the onStart event or in the onRefresh event if the values in the table change frequently.

A new PmgWTable object is created in the panel.
In this object, the methods InitTable and FillTable (without parameters) are created.
In the onStart event the script is added.
A new designer method GetDataTable (without parameters) is created in the panel.
The method InitTable:
Initialization of table dimensions and setting the table column names
JavaScriptSelect and copy to clipboard

// Dim(Cols,Rows,FixedCols,FixedRows,CellWidth,CellHeight,Interaction,Grid)
pMe.Dim(4, 1, 0, 1, 60, 20, 1, true);
pMe.SetCellText(0, 0, "col 0");
pMe.SetCellText(0, 1, "col 1");
pMe.SetCellText(0, 2, "col 2");
pMe.SetCellText(0, 3, "col 3");

pMe.Draw();
The method FillTable:
The GetDataTable panel user method returns an array of values, to populate the contents of the table.
JavaScriptSelect and copy to clipboard

var aData = pMe.PmPanel.Methods.GetDataTable();

if (Pm.GetVarType(aData, 1) == "PmArray")
{
var nFixRow = pMe.FixedRows;
var nRows = aData.GetSize(2);
var nCols = aData.GetSize(1);

pMe.RemoveRow(-3);
pMe.InsertRow(-2, nRows);

// Write data to table
var iRow, iCol;
for (iRow = 0; iRow < nRows; iRow++)
{
for (iCol = 0; iCol < nCols; iCol++)
{
pMe.SetCellText(iRow + nFixRow, iCol, aData.GetItem(iCol, iRow));
}
}
pMe.Draw();
}
The event onStart:
If the values in the table change frequently, then the FillTable method can also be called in the onRefresh event.
JavaScriptSelect and copy to clipboard

pMe.Methods.InitTable();
pMe.Methods.FillTable();
GetDataTable panel method:
An example is given, that returns an array of values from the PmaDataTable object.
But it can also be another data source from the application that populates the table.
JavaScriptSelect and copy to clipboard

var aData = pMe.Pm("/DataTable").GetArray("All", null);
return Pm.TransformValue(aData, 50);
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.