Do while - condition question

Hi all,

I have two datatables: dt1 and dt2
Dt1 is a file which contains names and deadlines (the names can occur more then once with a different deadline). Some of the names do not contain deadlines yet and I need to define whether they are available or not (the condition for available is (if date of today - deadline most in the future < 25 days).
Dt2 is a file with names (same names as in dt1)

I already have the code for determining if he/she is available.
But if he/she is not available it should go to the next row in dt2 and check the same.
It should do this until if found a name that is available.

How do I put this in a do while function? or any other suggestion?


did you tried linq?

Hi @pathrudu,

Thanks for your reply. No I have not tried that. I’m not familiar with it.
How should I use it?

Is it possible for you to provide sample data along with your expected output??

Hi @Divyashreem,

I cannot share it but I created an example and simplified it a little bit.
Please find the excel below. It needs to loop through the excel and I want to get the first “name” where the current deadline - the date of today (16/10/2018) is less then 10 days. so in this case I would expect as output “Elma”. The number of lines can vary when running the bot at different times, so it should be variable + the dates can vary as well.

Main.xaml (10.3 KB)

check this logic for the sample excel i have attached

sample.xlsx (8.6 KB)

1 Like

Hi @divyashreem,

Thanks! already very nice. One extra thing. The output is now giving me “Elma” and “Paul” in your example.
I only want to write the first occurence in the output, so in this case “Elma”.
How should I do this?

1.inside if block add those name to list
2. in if condition have one more check if list not contains the row.item(“Name”).

this will give you solution to your problem.

1 Like

Thanks, can you please add it to the xaml file you provided earlier? I think I am missing something.

Main.xaml (13.0 KB)

1 Like

Thanks again @Divyashreem,

I’m still seeing both names “elma” and “paul” instead of only “elma”. :frowning:
What should I edit?

Many thanks @Divyashreem,

I found it by adding “Name.First.ToString” out of the for each.


Small additional question: how can I check whether the collection is empty (for example if collection is empty then write line “status - on hold”)

just check collection.count>0

1 Like