In both the sheets my comparison column name is INTERNAL ID
If match found for example multiple in this case 2804 and 2805 is found in both the sheets or
I have done the following steps:
reading the outputsheet and storing in datatable-ExtractedData
reading the master data sheet and storing in data table -dt_sku
Taking a for each row in datatable (ExtractedData) and under that again
for each row datatable -dt_sku
Putting if condition
CurrentRow.Item(“INTERNAL ID”).ToString=Row.Item(“INTERNAL ID”).ToString And CurrentRow.Item(“RATE TYPE”).ToString=“Prepaid Subscription”
Then ,
Add DataRow,
CurrentRow.Item(“INTERNAL ID”).ToString=Row.Item(“INTERNAL ID”).ToString And CurrentRow.Item(“RATE TYPE”).ToString=“Prepaid Subscription”
ExtractedData.AsEnumerable.Where(function(x) x(“INTERNAL ID”).ToString.Equals(Row.Item(“INTERNAL ID”).ToString) ).Sum(function(x) CDBL(x(“Included units”).ToString))
However In my case I am getting 0 value even though Included units value in main sheet is 1700 and master sheet INTERNAL ID and Main sheet INTERNAL ID is matching
If I have three different conditions to check and then take the sum of Included Units. How shall we do that? where CurrentRow is for data table dt. I am checking in one single data table all the conditions.
Condition 1. CurrentRow.Item(“RATE TYPE”).ToString="Prepaid Subscription"and Convert.ToDateTime(CurrentRow(“START DATE”).Tostring) =StrStartDate And not CurrentRow.Item(“NAME”).ToString.Contains(“Rollover”)
Condition 2.CurrentRow.Item(“RATE TYPE”).ToString="Prepaid Subscription"and Convert.ToDateTime(CurrentRow(“START DATE”).Tostring) >StrStartDate And not CurrentRow.Item(“NAME”).ToString.Contains(“Rollover”)
Condition 3.CurrentRow(“NAME”).ToString.Contains(“Rollover”)Or CurrentRow(“NAME”).ToString.Contains(“rollover”)Or CurrentRow(“NAME”).ToString.Contains(“ROLLOVER”) And CurrentRow.Item(“RATE TYPE”).ToString=“Prepaid Subscription”