How do i check if it is approved?

Hi guys, im not sure how do i read the entire E cell to check if it is approved. And if it is approved i want it to send a email too. It keep getting error and wont be able to read the entire E range.

This is just a sample for reference



@SIM_BERTRAM

Welcome to forums

Use For Each row activity and inside that keep If condition

row(“Status”).ToString = “Approved”

Then->place your send mail activity

Hope this will help you

Thanks

1 Like

Like this? im still getting error…

Hi! welcome to the community!

Try like this!

  1. Take one excel application scope

  2. Read range from excel->Properties-> output as dt1 and don’t mention the Range

  3. Take one for each row in data table and mention dt1

  4. Now take one assign activity and create one string variable as Column. inside the value CurrentRow.item(“Status”).ToString.Trim

  5. take one if condition and mention like this Column="Approved"

  6. Inside the then take Use send mail activity

For your reference:

Regards,
NaNi

What variable do u set as dt1?

Hi!

dt1 is dataTable variable (System.Data.DataTable).

Reference: variable

Regards,
NaNi

@SIM_BERTRAM

Status is giving you error

It should be the datatable variable which you used in Read Range

Hope this may helpyou

Thanks

so what do i change to?

Hi!

You’re in correct path… no need to change anything but you can use .trim if the column Status has any spaces before or after.

so your expression look like CurrentRow.item(“Status”).ToString.Trim

after done with the if condition inside the then block use send Smtp mail message activity!

Regards,
NaNi

When i run it, got error…

Hi @SIM_BERTRAM,

Please find the below-attached project file

BertramExcelAutomation.zip (9.5 KB)

I hope your issue will get sorted with the solution.

Regards,
@90s_Developer

Hey!

Inside the Read range. mention the range as “A3”

Regards,
NaNi

@SIM_BERTRAM,

As per the screenshot provided, I have seen a few mistakes,

  1. Use Workbook Read Range, and mention the RANGE as A3 (because your column values starts from A3 with Headers) and enable Add Headers in the properties of Read Range and get an output variable (InputExcelDT)
    image

  2. Use For Each Row in Datatable to iterate through each row of the excel. Here, CurrentRow will hold the one row value.

  3. In excel, the Status column is placed in the D column (index is 4) i.e., A column index starts from 0 so, CurrentRow(4).ToString will give the values of the Status column one by one. This is retrieving values through the index or you can also retrieve values through column names also like CurrentRow(“Status”).ToString

  4. Now, inside the For-Each, check the condition in the incoming value of CurrentRow(“Status”).ToString = “Approved”, then in the then block (true means) use send outlook mail message activity and configure as per your required and in the else block (false means) nothing is required.

So, this will perform till all the rows get iterated in excel.

I hope these steps will give a clear idea to solve your issue and also I have given the sample workflow of your process above.

Regards,
@90s_Developer

1 Like

Thanks this works !!

Hi @SIM_BERTRAM

I think you need to use lookup data table here as you re comparing two data tables and getting the mail id from another data table and mapping with the staff id and if its approved sending the mail !
and setting the status and mail sent in the first data table.

Regards

@SIM_BERTRAM,

Happy Automation :v:

Regards,
@90s_Developer

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