in this linq query how to increment the position of temp0.ToString in the array
dt_output = ( From r In in_InputFile
Group By z=r("Country").ToString.Trim Into grp = Group
Let temp0 = grp.where( Function(x) x("Designation").ToString.Trim.Equals(currentItem)).Count
Let newRows = New Object() {grp(0)("Country").ToString,temp0.ToString}
Select dt_Output.Rows.Add(newRows)).CopyToDataTable
the scenario is that as the temp0.ToString is set at index 1, it is overwriting the values that is already there
so my idea is to give it a position based on a counter
this code is already in a loop and has a counter variable called Count, the currentitem as the var that is holding the value inside the .equals(currentitem)
The previous scenario includes static values so the previous linq was like this
( From r In in_InputFile
Group By z=r("Country").ToString.Trim Into grp = Group
Let temp0 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("ABC")).Count
Let temp1 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("POR")).Count
Let temp2 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("PQR")).Count
Let temp3 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("DEF")).Count
Let temp4 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("wxy")).Count
Let temp5 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("Avr")).Count
Let temp6 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("ABc")).Count
Let temp7 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("MNP")).Count
Let temp8 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("GHI")).Count
Let temp9 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("xyz")).Count
Let temp10 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("FHI")).Count
Let temp11 = grp.where( Function(x) x("Designation").ToString.Trim.Equals("STV")).Count
Let newRows = New Object() { grp(0)("Country").ToString,temp0.ToString,temp1.ToString,temp2.ToString,temp3.ToString,temp4.ToString,temp5.ToString,temp6.ToString,temp7.ToString,temp8.ToString,temp9.ToString,temp10.ToString,temp11.ToString}
Select dt_Output.Rows.Add(newRows)).CopyToDataTable
as u guessed the currentitem is holding the value that is used in
.Equals()