Narasiman nar

Narasiman nar

  • NA
  • 64
  • 20.3k

how to check for this id this answers

May 23 2018 2:29 AM
 
 id       Name     farmerdetailsdata                               Pro1    Pro2   Pro3
123     Test1      {"pro1": "A","Pro2":"A","Pro3":"B"}      A          A           B
124     Test1      {"pro1": "C","Pro2":"C""Pro3":"A"}       C         C           A
 
 
 using dot net code i split json and put into each column header in excel
 
int col1 = 43;
List<string> lsts1 = new List<string>();
foreach (DataRow rowss in dtFarmerFarmReports.Rows)
{
var dicts1 = JsonConvert.DeserializeObject<Dictionary<string, string>>(rowss["farm_detailsdata"].ToString());
 
string str = string.Empty;
lsts1.AddRange(dicts1.Values);
}
var distinct1 = lsts1.Distinct().ToList();
foreach (var datas in distinct1)
{
col1++;
worksheet.Cells[3, col1].Value = datas;
}
 
from the above code i get output as follows
 
id      Name         farmerdetailsdata                                Pro1      Pro2        Pro3
123   Test1    {"pro1": "A","Pro2":"A","Pro3":"B"}       A             B
124   Test1    {"pro1": "C","Pro2":"C""Pro3":"A"}        A             B
 
for the second id 124 i am getting the same answer of  123 id.
 
how to check and display for 123  A B answer and for 124 C A.
 
please let me know. what changes i have to made to display answer based on id.
 
how to check for this id 124 id   C C A is the answer.
 
what changes i have to made in my above code.