Sending outlook mail if value does not exist in excel

Hi All,

I am working on a problem where in i have an excel sheet and around 5 columns like below -

Capture987

Now in the above sheet you can see that for three records(Highlighted) the vehicle No is there but rest all the values are not there.
Now when i see such a scenario i need to generate an outlook mail by entering all the 3 vehicle numbers in the mail.

How can i go about creating a workflow for this problem.

Regards
Arjun

Hi @shekhawat.arjun1307

We can try looping through column “D” in which placing an IF condition which checks whether the cell contains value or not
After this we can store this in an array or we can make datatable to add these rows containing values
finally sending the mail with either datatable rows or array values

Regards,
Shaf

Hi @shekhawat.arjun1307

Loop through the column B if the column has empty value take the corresponding column D and store it as array variable and send mail through oulook

Created a xaml based on your excel values

Please refer below.

Test.xaml (10.4 KB)

Hope the above helps you!

Regards

1 Like

Hi @pravin_calvin

I have few questions to clarify.


in the above image in the if condition - CurrentRow(0) here 0 specifies the first column??


I can’t understand what you have done here.

Hi @shekhawat.arjun1307

Its taking the corresponding value which is null and storing the rows as array.

Regards

From x(1) → first column?

@shekhawat.arjun1307

Taking the column(“Number”) and checks wheather the row has null value.

If it has null value then

Taking the x(“vehicle_no”) and storing the value in array.

Hope the above explanation clears you!

Regards

@shekhawat.arjun1307

Let me know if you have doubts!

Regards

Hi @pravin_calvin


I want to check the first column → row(0) for null values


the corresponding value i need to fetch from column 9th → x(8)

But i am getting all the values of column 9th like below

@shekhawat.arjun1307

Check the row If its Null you need to send mail with that Veichle Number.

And check For Other row If Its null send mail with that Veichle number.

Hope i understood correctly!

If possible can You share me your excel file?

Regards

Hi @pravin_calvin
From the pic of the first excel sheet which i posted in this question - let’s say the first column “Name”
the first record(Prashant) is not present, in that case i need to store the vehicle no(57JHK)
and then send out an outlook mail that vehicle no(57JHK) documents are not there, this is just for one record, in general i need to iterate over the entire “Name” column and need to check where there is a missing record i need to capture the corresponding value(values if there are multiple missing values in "Name column) from column - “Vehicle no”.

Regards
Arjun

Hi @shekhawat.arjun1307

@ppr , @Yoichi will Help you with this Query.

Regards

Hi,

The following will work for your first request.

img20210817-1

Sample20210817-1.zip (6.9 KB)

Regards,

1 Like

would lead to following interpretation:

take Vehicle No if other column values are blank.

Assign activity:
left side: arrCheckCols | Datatype: String( ) - String Array
right side: {“Name”,“Number”,“Date”}

Assign activity:
left side: arrNoOrphans | DataType: String()
right side:

(From d in YourDataTableVar.AsEnumerable
Let chk = arrCheckCols.Any(Function (x) isNothing(d(x) OrElse String.IsNullorEmpty(d(x).toString.Trim))
Where chk = false
Select s = d("Vehicle no").toString).toArray

Now, with arrNoOrphans we got the orphaned Vehicle Nos as an array and can use it within the MailBody e.g.

String.Join(",", arrNoOrphans) - one line, comma seperated
Or
String.Join(Environment.NewLine, arrNoOrphans) - every no within an new line (Text Emails)
Or
String.Join("<br>", arrNoOrphans) - every no within an new line (Html Body Emails)

1 Like

Hi @Yoichi

In your solution if i only need to check the null values in “Name” column and then corresponding value i need to pick from “Vehicle no” then i need to make this change, correct?

Hi,

Broadly correct. However your expression will return not only “vehicle no” but also some blank, because the following yellow cell match with your condition.

img20210817-2

If you want to except them, the following will work, for example.

String.Join(vbCrLf,dt.AsEnumerable.Where(function(r) String.IsNullOrWhiteSpace(r("Name").ToString) AndAlso  (not String.IsNullOrWhiteSpace(r("Vehicle no").ToString))).Select(Function(r) r("Vehicle no").ToString))

Regards,

1 Like

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