If condition else part alone is working

in if condition even my condition is correct it always goes to else part ,can any one give idea on this? please .

2 Likes

Hi @priyankavivek
Can you show us the condition? :slight_smile:

as iam comparing two excel ,so i used to compare the column so i have given the condition as row(0).to string = row1(1).tostring

It should be just row(0).ToString = row(1).ToString
:slight_smile:

condition is satisfying but else part is printing
excelelse

1 Like

Buddy @priyankavivek

When you compare two datatable

  1. Use two for each row loop and pass the first dt to the for each row and second dt to the second for each row…
  2. Inside the second for each row use a if condition and mention like this buddy…as you did now…or even this
    row(0).ToString.Trim.Equals(row1(1).ToString.Trim
    But make sure that those columns are exactly what to be compared…if they dont have any equal value between them it will go to else part only buddy…
    And make sure you have used a bread in then part so that it wont iterate again inside the second foreach Row loop once we have found a match…as it should go to the next row in first for each row…rows…
    Thus making sure its not repeating again in second for each row loop even after a match is found

Thats all buddy you are done…
Kindly try this and let know buddy
Cheers @priyankavivek

2 Likes

even if it has matching datas though my condition is correct(using writeline founded the output),else part is running is any idea on this?

Hi @priyankavivek,

before checking condition put log message and check both the value are same format and same value.

Regards,
Arivu

Buddy did you try with the condition that i provided like…
row(3).ToString.Trim.Equals(row1(8).ToString.Trim)

The reason why added trim is sometimes there might some space aftrr the words that wont let them match
Kindly try this and let know buddy
Cheers @priyankavivek

now i try with this

1 Like

its in same format ,when i didnt use any activity in else part ,then part is running,otherwise else alone running

were able to buddy @priyankavivek

nope

No worries
Buddy can i have a view on your xaml and xlsx file with project.json as well, all together in a zipped folder if possible, cheers
@priyankavivek

this is what i have done buddy but whenever i use some activity in else it will run only else part as it confidential i cant the excel sheet i can share the flow can i?

yes of course buddy @priyankavivek

excelcoret.xaml (21.4 KB)

please correct me if iam wrong on anypart also,thank you

use break in innermost if.

1 Like

Use Break activity in innermost IF.
And best way will be use Add Data Row inside innermost if and then use break.

for getting “no” what activity i can use in excel