How to compare null and different value rows in excel conditions

HI ,


I need a solution for the following condition:
Action is null and material id is null then result is Invalid
Action is value and material id is null then result is Material id is invalid
Action is null and material id is value then result is action id is invalid
Action is value and material id is value then result is action id is created
Main01.xaml (23.9 KB)

how can i rectify my error.
Book1.xlsx (8.5 KB)

Hi @Abubakkar

Make “action” variable string or convert that to string in If condition:
string.IsNullOrEmpty(action.ToString)

Thanks.

Hi,
Thanks for your help.
Can you find where can i mistake this workflowMain01.xaml (15.8 KB)

Yes,
“MATID” is of generic type, you should convert it into String Type to use Contains in an expression.

Yeah I changed “Matid” scope even though the same Error occured

For your references Main01.xaml (20.9 KB)

I observe here:
matid.Contains(“0”) = true
You are checking an integer with Contains which is wrong,
it should be:
Convert.ToDouble(matid)=0
First you should convert that into Double then compare with 0, you can’t compare two different datatypes.

Replace that line with:
Convert.ToDouble(matid)=0 and Convert.ToDouble(action.ToString)=0

Thanks@goutham even though after that again same error occurred

Main01.xaml (17.9 KB)

String.NullOrEmpty(action.ToString)
Try above

2 Likes

Main01.xaml (23.0 KB)
@Abubakkar

please check this one

1 Like

you are getting this error because some rows in Column ‘Action’ do not have any value…
when a row is empty for any column and you are assigning that rows value to a variable ( in our case it is ‘action’), it does not get assigned as row is empty, hence variable was not initialized and you are getting Object Reference error…

Solution: instead of checking this string.IsNullOrEmpty(action.ToString()) = true
try String.IsNullOrEmpty(row(“Action”).ToString()) = true

1 Like

@Abubakkar
is this what you are looking for?

1 Like

first thanks for your help @rahatadi.
Currently I’m doing SAP automation project.
This is one of my requirement SAPAutomation2.xlsx (11.4 KB)

Initially I need to validate this excel sheet
Next if I get any error in middle of the project. I extract that error into excel sheet.
simontanisly my project also executed which means EXCEPTION HANDLING
this is my project Main.xaml (1.2 MB)

@Abubakkar

to summarized all,

you want to filter excel for non-empty “action” and “material id”.
if there is any row or data, you will process further ?

is this right ?

yeah exactly right if there is any error occurred first row then I should extract that error into excel sheet. After that execute next row if there is error occurred fetch the error then return to home page execute next row.
Thanks in Advance

@Abubakkar

use ReFramework, and just modify update status workflow for excel.

I try to validate entire excel sheet but I can’t do this validation

@Abubakkar

validation on basis of ?

using if condition string.isnullorempty(" ")

@Abubakkar

have you checked workflow that i have uploaded before?