write A1 yield & strawYield to output

update definitions
update TODO.txt
This commit is contained in:
2024-03-11 14:35:03 +01:00
parent 67014e20f5
commit ffbb45894a
6 changed files with 89 additions and 75 deletions

View File

@@ -403,50 +403,50 @@ namespace FarmmapsKPI
if (kpio.id != kpioPrevious.id)
{
KPIelementsOfBalance kPIelementsOfBalance = kpio.data.values;
//if (kpio.id == "A1") //TtD not functional
//{
// //Make a new dataList = new line to be written
// //Fill the datalist with this kpi
// dataList = new List<string>
// {
// kpio.parentName,
// cropfieldItem.Code,
// kpio.data.area,
// kpio.data.cropTypeCode,
// kpio.data.cropTypeName,
// kpio.id,
// kpio.quantity, // in KPI output quantity is what we call KPIvariable in headerlist of csv file
// kpio.value,
// kpio.unit,
// kpio.targetValue,
// kpio.thresholdValue
// };
// //Write the datalist to a line to the streamwrieter sw for the output csv file
// sw.WriteLine(string.Join(",", dataList));
// foreach (string elementName in kpio.A1elements)
// {
// // get A1element from the element called values
// string elementValue = (string)kPIelementsOfBalance.GetType().GetProperty(elementName).GetValue(kPIelementsOfBalance, null);
// dataList = new List<string>
// {
// kpio.parentName,
// cropfieldItem.Code,
// kpio.data.area,
// kpio.data.cropTypeCode,
// kpio.data.cropTypeName,
// kpio.id,
// elementName, // specific output variable name for A1 element
// elementValue, // specific output value name for A1 element
// kpio.unit,
// "",
// ""
// };
// //Write the datalist to a line to the streamwrieter sw for the output csv file
// sw.WriteLine(string.Join(",", dataList));
// }
//}
//else if (kpio.id == "B1")
if (kpio.id == "B1")
if (kpio.id == "A1") //TtD not functional
{
//Make a new dataList = new line to be written
//Fill the datalist with this kpi
dataList = new List<string>
{
kpio.parentName,
cropfieldItem.Code,
kpio.data.area,
kpio.data.cropTypeCode,
kpio.data.cropTypeName,
kpio.id,
kpio.quantity, // in KPI output quantity is what we call KPIvariable in headerlist of csv file
kpio.value,
kpio.unit,
kpio.targetValue,
kpio.thresholdValue
};
//Write the datalist to a line to the streamwrieter sw for the output csv file
sw.WriteLine(string.Join(",", dataList));
foreach (string elementName in kpio.A1elements)
{
// get A1element from the element called values
// TtD 20240311: note elements of A1 are in the data structure elements of kpio.data and not as below for B1, B2, etc as kpio.data.values
string elementValue = (string)kpio.data.GetType().GetProperty(elementName).GetValue(kpio.data, null);
dataList = new List<string>
{
kpio.parentName,
cropfieldItem.Code,
kpio.data.area,
kpio.data.cropTypeCode,
kpio.data.cropTypeName,
kpio.id,
elementName, // specific output variable name for A1 element
elementValue, // specific output value name for A1 element
kpio.unit,
"",
""
};
//Write the datalist to a line to the streamwrieter sw for the output csv file
sw.WriteLine(string.Join(",", dataList));
}
}
else if (kpio.id == "B1")
{
//Make a new dataList = new line to be written
//Fill the datalist with this kpi