I have a datatable with 4 columns of data, the first with limit values and the next 3 with the maximum values (of a different table). I need to run a truth table that will find the first value which fails limval > maxval. Then I need to output the maxval column name and limit value which it failed at. This is how I've done the truth table so far.
dtTruth = new DataTable();
dtTruth.Columns.Add("Truth", typeof(double));
double truthval;
for (int i = 0; i < dtLimits.Rows.Count; ++i)
{
truthval = 0;
if ((Convert.ToDouble(dtP2P.Rows[i]["Limits"]) > (Convert.ToDouble(dtP2P.Rows[i]["MaxVal1"]))))
{
truthval = 1; //pass -> not out of bounds
}
else
{
truthval = 2; //fails -> well parameter is out of bounds
}
dtTruth.Rows.Add();
dtTruth.Rows[i]["Truth"] = truthval;
}
}
I need to export the column name and limit value where the first 2 occurs Open to any and all suggestions of how to do this (or change how i've done the truth table) Thanks!