@glory1 Can you show us the error that you get , The Image that you have Shown us is a bit Small Also can you tell us what you want to do actually?
I had tried that already…
This is the error:
are you comparing complete data row? or a value in particular cell?
Muralidhar, Comparing value in a particular cell;
superman,
the Requirement -
two dt - dt1, dt2 (huge data) …
match first col of row1 to first col of row2
if match found… assign third col of row2 to third col of row1.
'm using (for each row1, row2…)
the problem is even if the match is found and assigned, its keep looping till the end before processing the next record; as its 30k to 40k records… loop goes never ending.
@glory1 I think you need to perform a Join Datatable Operation, If you are comparingTwo Datatables row Values
yes I’m using join to find the matches, after finding the matched records to assign value 'm using for each… any other method?
Yes Ashwin, it seems relevant… just that for me 'tis confusing to apply for my solution.
@glory1 Can you show us a Sample Input Files and an Output File how you are expecting it to be, In that way we can give you the proper Suggestion
've attached a sample sheet, in actual its with more 120 columns and 50k records.Book1.xlsx (9.6 KB)
@glory1 If it’s 50k records, We might need to use Linq Query, Using For Each will take up a Lot of time, I’ll try to find a solution using Linq
Take 3 Variables and assign it as 0
count_P
count_A
count_H
ForEachRow in DataTable
{
forEach(column in row)
{
if(row(column).equals(“P”))
{
count_p=count_p+1
}
if(row(column).equals(“A”))
{
count_A=count_A+1
}
if(row(column).equals(“H”))
{
count_H=count_H+1
}
}
}
take column as int
@glory1 What if there is a row in DT1 which doesn’t match with the row in DT2, How would the Output be in that case?
If not matched, no change n to process next.
oh yeah, but here the count of occurrences are incremented; but i’m asking about incrementing the row index of a dt.
can someone guide me in how to increment rows index please?
@glory1 Can you Check this :
I don’t know if this is what you wanted, also check when UnMatching rows are present, also If you’re using 120 Columns kind of File, it is not so Good to use , But you can try
MatchedValuesUpdated.zip (13.6 KB)
oh yeah, in this we need to specify the columns to be picked up right … in my case to specify 120 columns ---- is there way to select the whole table after updating by not specifing the columns?
@glory1 Yeah we need to Specify 120 Columns , that’s why it’s not a good way , or Need to figure out something better than this code