GridRow Equation |
The following code snippet can be used to set the 4th control in a grid row equal to the sum of the first 3 controls in the same row.
Complete theses steps to add this functionality to your application.
// IMPORTANT: for use with OnEndValueChange of each control used in the equation public void GridRowEquation(object sender, TagSubscriptionArgs subscription, TVQ tvq) { IControlParent parent = (sender as ControlBase).Parent; // get values of first 3 controls in grid row TVQ tvq1 = ControlBase.GetProperty<TVQ>(parent.Children[0], "Value"); TVQ tvq2 = ControlBase.GetProperty<TVQ>(parent.Children[1], "Value"); TVQ tvq3 = ControlBase.GetProperty<TVQ>(parent.Children[2], "Value"); // calculate sum of values double sumValue = (tvq1?.ValueToDouble() ?? 0) + (tvq2?.ValueToDouble() ?? 0) + (tvq3?.ValueToDouble() ?? 0); TVQ sumTVQ = new TVQ(DateTime.Now, sumValue, 192); // update 4th control in grid row with result ControlBase.SetProperty(parent.Children[3], "Value", sumTVQ); }