If Statement not recognizing condition

Hellom I’m trying to get my else if statement invoke a new workflow if it finds a certain row in an excel file blank. I know the cell is blank and I’m pretty sure my file references correct, and the bot runs to completion without errors, but it just keeps seeing the error is false?

Any help greatly appreciated!

1 Like

1 Like

1 Like

@Faded

you gave a space …space is not equals to blank

try Excel_Data_Scams.Sheet("BillDate").ToString.Trim.Equals("")

" " is not ""

cheer

1 Like

This did not work. It still didn’t recognize it as true.

1 Like

Print this value in watch pane or write line.

Excel_Data_Scams.Sheet(“BillDate”).ToString.Trim

1 Like


I get this value. That doesn’t tell me what value is currently in Excel_Data_Scams.Sheet(“BillDate”)

1 Like

Hi @Faded

I think you are trying to check the If condition inside the For Each Excel Row. If yes, then try the below way:

Not String.IsNullOrEmpty(CurrentRow("BillDate").ToString.Trim())

or try the below syntax:

CurrentRow("BillDate").ToString.Trim().Equals("")

Regards

@Faded

oww one more thing to note…sheet(“Name”) will take only name but not the columns

currentRow("BillDate").ToString.Trim.Equals("")

or

currentRow("BillDate").StringValue.Trim.Equals("")

cheers

Both versions of the equation gave me an error like below:


Yes, I keep trying many variations of this equation, yet I keep getting this error that I don’t understand. The only object here to be declared is Current Row, which I did set in “For Each Current Row”. Do I have to set the object again in the if statement?

Hi @Faded

Can you share the screenshot of the whole workflow.

Regards


image



image
That was the first sequence:
This is the one that activiates upon the if statement being true:


Everything after this are write cell functions which I’m pretty sure are working right. imported them from a previous successful file
Thank you for looking at this for me!
@vrdabberu

@Faded ,

Can you try this in condition - Not String.IsNullOrEmpty(CurrentRow.Item("BillDate").ToString.Trim())

Thanks,
Ashok :slight_smile:


Same issue unfortunately. I don’t understand what object isn’t getting set.

@Faded did you try using the If activity instead of ElseIf?

@Faded ,

I think I got the issue here. We can’t directly read the cell value as CurrentRow.Item(""BillDate").ToString

What’s other option? Here we will have to use Get Cell Value and store it into Object type variable. Once we have the value we are ready to compare it. Like this.

Not String.IsNullOrEmpty(GetCellValueOutputVariable)

This should work.

Thanks,
Ashok :slight_smile:

Same issue I’m afraid:

Test to remove ToString() because it will fail if value is null.

Not String.IsNullOrEmpty(value)

I did. It gave me the same issues