Display answers based each questions using id
Display answers based each questions using idin excel i have following data as follows
ID Name Suggestions
1 OLAMDEV "Produto preferido":"Algodao", "Plantou algodaono":"Sim"
2 OLAMDEV1 "Produto preferido":"Feij Buer","Plantou algodaono":"Sim"
From above i want output in excel
id name Produto preferido Plantou algodaono
1 OLAMDEV Algodao Sim
2 OLAMDEV1 Feji Buer Nao
Code as follows
int columnindex = 43;
List<string> lst = new List<string>();
foreach (DataRow row in dtFarmerFarmReports.Rows)
{
var dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(row["farm_detailsdata"].ToString());
string str = string.Empty;
lst.AddRange(dict.Keys);
}
var distinctList = lst.Distinct().ToList();
foreach (var data in distinctList)
{
columnindex++;
worksheet.Cells[2, columnindex].Value = data;
}
int col = 43;
List<string> lsts = new List<string>();
foreach (DataRow rowss in dtFarmerFarmReports.Rows)
{
var dicts = JsonConvert.DeserializeObject<Dictionary<string, string>>(rows["farm_detailsdata"].ToString());
string str = string.Empty;
lst.AddRange(dicts.Values);
}
var distinct = lst.Distinct().ToList();
foreach (var datas in distinct)
{
col++;
worksheet.Cells[2, col].Value = datas;
}
When i run the above code i get output as follows
id name Produto preferido Plantou algodaono
1 OLAMDEV Algodao Sim Feji Buer Sim
2 OLAMDEV1
i want ouput as follows
id name Produto preferido Plantou algodaono
1 OLAMDEV Algodao Sim
2 OLAMDEV1 Feji Buer Sim
from the above what changes i have to made to display the answers based on each id.
Please help me.
what changes i have to made in my above code to display answers based on each id.