Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Filling up the table

The example fills up the column Temperature of the table from the example about the initialization of the table by values and the subsequent coloration of this column cells with respect to the Minimum and Maximum columns.

Let's have the PmiAx graphic item in the oAx variable placed in the image editor (this graphic item is set to the PmTable ActiveX object).

Example:
JavaScriptVBScriptSelect and copy to clipboard

var i, Temperature, Minimum, Maximum;
var oAxTable = pMe.Acx;
var nRows = oAxTable.Rows - 1;

oAxTable.SetCellText(0, 0, "Temperature");
oAxTable.SetCellText(0, 1, "Minimum");
oAxTable.SetCellText(0, 2, "Maximum");

//*** Filling up the "Temperature" column with random values
Minimum = 20;
Maximum = 80;
for (i = 1; i <= nRows; i++)
{
  oAxTable.SetCellText(i, 0, Pm.Round(Pm.Random(0, 100), 1));
  oAxTable.SetCellText(i, 1, Minimum);
  oAxTable.SetCellText(i, 2, Maximum);
}

//*** Checking the limits of values
for (i = 1; i <= nRows; i++)
{
  Temperature = Pm.Round(oAxTable.GetCellText(i, 0), 1);
  Minimum = Pm.Round(oAxTable.GetCellText(i, 1), 1);
  Maximum = Pm.Round(oAxTable.GetCellText(i, 2), 1);

  //color setting by RGB String (LightBlue or LightRed)
  oAxTable.SetCellBackColor(i, 0, Temperature > Minimum ? "#a8ccf0" : "#ff6868");
}
oAxTable.Draw();
PROMOTIC 9.0.0 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice