Use else from If activity to go back to another activity

Hello guys. How can I use the else from IF activity to go back to go to another activity?
Thanks!

can you elaborate your issue?

Thanks

I need to check through an excel file and check if a row contains a string else to recheck.

you can include your sequence in else part

You could use a do while loop here.

So if your row contains a string check the next row or that same row?

Use For Each Row

Hi @Ionut_Frincu,

You can use a "flowDecision’ activity and loop back to another activity instead of a “if” activity. If your requirements wants you to use “if” activity only then use “While” loop activity.

Thanks,
Vish

I need to check through an column for each row that is empty into a excel file. How can I do this?

If you want all the rows that have an empty value in a single column and then write it into an excel file, you can use the below:

Assign newDatatable =  Datatable.Select("[ColumnName] =''").CopyToDatatable

Write Range - new Datatable 

This will returns all the rows where your column has an empty value into your excel file.

Actually I have 4 columns, and i need to iterate through the fourth and select each empty row with the fourth column

Hi,

Here first create a datatable variable ex:BuildDT

  1. Use excel application scope and give excel file path, which you want to read
    2)Inside excel application scope use read range activity and output will be Datatable variable ex:DT1

Now use an assign activity
Assign
BuildDT = DT1.clone

  1. Now below to the excel application scope, use for each row activity
    For each row of DT1
  2. Inside for each row activity, use ‘get row item’ activity and give the column property value as 3 , the output for this get row item activity is string variable ex:Str1

Now use if condition
If
Str1.contains(“your expected string”)

Then
Leave blank

Else

Use add data row activity
In array row property give value as ‘row.itemarray’
datatable property value will be BuildDT

  1. Now below outside for each row , use excel application scope with write range , and input datatable will be BuildDT

This will give you all the rows that are not having value at 4th column of excel file

Thank you mate! I appreciate! :slight_smile:

1 Like

what do you mean by “give the column property value as 3”? Thanks!

Hi
hope these steps would help you resolve this
—Use a excel application scope and pass the file path of excel as input
—inside the scope use READ RANGE activity and get the output with a variable of type datatable named dt
—now use a FOR EACH ROW loop and pass the above variable dt as input
—inside the loop use a IF condition like this
NOT String.IsNullOrEmpty(row(“yourcolumnname”).ToString)
This condition will check whether the column value for each has value in it or not
If true having value it will go to THEN part where we can have our process or set of activities to be performed if we have activities in then
Or if that fails as we have empty column values it will go to ELSE part where we can have that relevant set of activities

Kindly try this and let know for any queries or clarification
Cheers @Ionut_Frincu

Hi, it’s 4th column index
The index will be 3 for the 4th column
Or
You can give 4th column name in ‘column name’ property

When using “for each” loop - you can use the “Continue” activity when you want to move to the next item. to stop the for loop, you can use “Break” activity

1 Like

So you can use my statement and simply enter the name of Column 4 instead of Column Name.

And how can I write in the same cell after this?