Flow Decision with an Integer

Hello,

I have a flow decision off of a datatable. Meaning I need >0 to be “true” and <0 to be “false”. After I have a datatable formed, I need to skip the next step if the flow decision is false (<0). If the flow decision is true (>0), I need the bot to go to the next step.

How would I achieve this? Am I thinking about this the wrong way?

1 Like

Hi Sara
Kindly elaborate a bit more on your scenario pls…
This can be resolved easily with your elaborative description
What variable and of what datatype variable you would like compare with >0 or <0
Kindly don’t mistake sara
Cheers @Sara_Car

@Palaniyappan I apologize, yes I will elaborate.

I have a datatable that I form from an excel report. If that datatable is empty (if there is no data for that day), I need the bot to continue on to the next step. If the datatable isn’t empty, I need it to process.

I’m attempting to avoid a giant IF activity, I know that would work. But I wanted to learn how to do a flow decision. If I can make it accept an integer, instead of a Boolean, that would fix my problem. I also don’t want to create numerous variables. If that is what I have to do, I will do this. But I thought a Flow Decision would be new to learn and would be an easier fix. I apologize if I am mistaken.

1 Like

Fantastic
So lets take a datatable named outdt variable which is created from a excel report
to check whether that has any row that is any data or not we can do by this
outdt.Rows.Count>0 (has rows, that is has data)
outdt.Rows.Count<0 (has no rows, that is it doesn’t have any data)
–this Rows method with its count property gives us the no of row count in the datatable that tells us whether the datatable has data or not, as obviously datatable is made of rows only right

so you can keep any of these condition in flow decision as a condition and lets take this
outdt.Rows.Count>0
if this condition gets passed it means as true and you can process the data
if not it means as false and you can leave it and go for the next
Kindly try this and let know buddy
Cheers @Sara_Car

2 Likes

Yeah, I think you are going about it correctly. Flow chart is probably better.

You condition will need to convert the value to a number (Double) or integer (Int32). If you type Convert., you should get a list in a dropdown, then look for ToDouble or ToInt32. It will end up looking like this:
Convert.ToDouble( row("columnname").ToString.Trim ) >= 0

One direction will be the True side and one will be the False side. If you want to reverse the directions, just reverse the condition to < 0. In the Properties pane of the Decision activity, you can rename the True and False to whatever you desire as a label for what it is doing.

EDIT: Sorry, I realize you want to check if the data table has content. Then, you can use this:
dt1 isNot Nothing AndAlso dt1.Rows.Count > 0

That condition will check if dt1 has a value, and if true then check if the number of rows is > 0. That’s usually the ideal method to check.

I hope this helps.

Regards.

2 Likes

@ClaytonM and @Palaniyappan

Thank you both for this. I attempted both and both worked.

Thank you so much! This is greatly appreciated!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.