Conditions on Excel dates

Hi Everyone, I have an excel file with the ‘Last login’ where the user last logged into the system.
image

So I want a condition that will only fetch 2023 last loggins not 2022.

Please check this thread it looks like same

if you have different requirement then please provide the sample file with expected output

Regards

Hi @Anelisa_Bolosha

This is the workflow which you can use.
DateDataTable.xaml (7.3 KB)

Expression used is:

loginDT.AsEnumerable.Where(function (x) DateTime.ParseExact(x(“Last Login Date”).ToString,“yyyy/MM/dd”,Globalization.CultureInfo.InvariantCulture).Year=Now.Year).CopyToDataTable

This would be taking the current year, you can change the condtion if you want.

Thanks and Happy Automation!

2 Likes

Thank you it worked

Most Welcome @Anelisa_Bolosha

You can mark the post as solution for future references it’ll help others.

Thanks


Please also assist Now I want to put that file in a for each loop to read for each branch and give results after, e.g,
for FMCI it should read each user branch seperated by those commas then send all the branches to that email.

Hi @Anelisa_Bolosha

Usually it’s suggested to open a new thread whenever a new question arrives.

Here you need to use a split operation on User Branch.
for eg:
string Branches= currentRow(“User Branch”).toString.Split(","c), you have now an array in Branches variable which you can use to update in mail.

Ohk apologies about that, thank you will try it out

No Issues :slight_smile:

Using for each activity right?

Yes For each row in DataTable. Since that looks like a excel file to me, use read range and iterate through them.

1 Like


How would I arrange this flow and then output results after

Can you tell your exact Requirement with respect to that screenshot,
what kind of output are you expecting

Okay, so after it has read the excel file with user groups separated by commas it should then give out each user branch.
The screenshot above can you please assist me with the flow there

in the assign suppose to be item mistake but fixed it still has error, where am I going wrong please help

Your DT_UA looks like it’s showing an error.
and instead of For Each loop use a For Each Row in DataTable loop

Hi @adiijaiin I was able to do it thanks

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