How to get the datatable based on the column(integer)


#1

Hi Developers,

MRTA.xls (1.5 MB)
In the attached excel the column G has dates in it, i want to get the third latest date into the datatable

in which the column [ADOI] has values as 20180410, 20180409, 20180406,20180405,20180404,20180403, 20180402 like that . so my challenge is i need to read the datatable and in which if column of ADOI value is third recent date or third highest date should get into the different datatable i.e., 20180406

please find the attachment

@arivu96


#2

Hi @lalithya14,

use Read range to get the data into data table (dt).

dt = dt.Select("",[ColumnName] desc").CopyToDataTable()
strthirdDate=dt.Rows(2)("ColumnName").ToString()

Regards,
Arivu


#3

how to get the last month last day ,
EG., today is 12042018 if i run the logic i need to get 31032018


#4

Hi @lalithya14,

Refer this post,

Regards,
Arivu


#5

strlastDay=DateTime.DaysInMonth(2018, 3).ToString() its working and again i need to check it should not be saturaday or sunday .

i want to assign strlastDay variable to Datetime ,variable help me

how to convert a string type variable into Datetime variable


#6

Hi @lalithya14,

Refer this post,

Regards,
Arivu


#7

excatly but in the place of now.adddays(-1) , i need to get lastmonth, lastday as DateTime.DaysInMonth(Year, Month).ToString()

last_ride1.xaml (15.7 KB)
please refer to my xaml file i am unable to pass prevDay.DayOfWeek<dayofweek.Saturday And prevDay.DayOfWeek>dayofweek.Sunday


#8

HI @lalithya14,

Use this one
last_ride1.xaml (11.9 KB)

Regards,
Arivu