Find Highest date

#1

Hi guys,
i am fetching data from datatable in string format and its like ps1=“2019-05-08”
ps2=“2019-05-11” ps3=“2019-08-02” i.e yyyy-MM-dd
Although these are dates but they have been saved in string format
now i want the bot to extract the highest date among these and sometimes it can be 3 fields or 2 fields or 1 or 5 fields so among them it has to pick highest date like over her it is “2019-08-02”
how can it be done considering that there can be ps1 and ps2
or ps1,ps2,ps3

#2

Hi Somya,

From your process is it possible to figure out how many number of string variables you will be getting?

#3

It may be 2,3 or 4

#4

In this format you can just sort them as string and get the bigger one

#5

Can u provide with the xaml…as it also depends if any of these string are present or not

#6

If they are blank strings, they still can be sorted. Check this if it solves your problem

Main.xaml (7.9 KB)

#7

here in the example you have used build datatable activity and input dialog from which you are taking dates and storing in build datable activity output variable but in my case bot will be reading date string directly from datatabase.
i have used foreach loop and inside that assign variables to assign values coming from database.Now the sorting needs to be done on them.
So do i need to use Builddatatable activity in that case also?