lakshmi.mp
(Lakshmi Mp)
October 9, 2023, 11:56am
1
Hi all,
How to compare the current date with the column of excel.
Used this condition not able to write the compared data to excel.
Current date =>
now.AddDays(5).ToString("dd-MM-yyyy")
Column date
Condition to compare:
CDate(End_dateRow).ToString(“dd-MM-yyyy”) >= Current_date
Please guide me on this.
lrtetala
(Lakshman Reddy)
October 9, 2023, 11:58am
2
Hi @lakshmi.mp
End_dataRow=Datetime.ParseExact(CurrentRow("Column date").ToString, “dd-MM-yyyy”, System.Globalization.CultureInfo.InvariantCulture)
In If Condition
End_dataRow>=Current_date
lakshmi.mp
(Lakshmi Mp)
October 9, 2023, 12:07pm
3
@lrtetala ,
Can you check this screenshot.
lrtetala
(Lakshman Reddy)
October 9, 2023, 12:09pm
4
@lakshmi.mp
After For each row in data tale you can please this activity
supriya117
(Supriya Allada)
October 9, 2023, 12:10pm
5
Hi @lakshmi.mp
Try this:
For comparing:
DateTime.ParseExact(row("End_dateRow").ToString(), "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture) >= DateTime.Now.AddDays(5)
Hi @lakshmi.mp ,
Hope you are doing good.
If you don’t mind, can you please elaborate what needs to be done, is today date needs to compare with date in the Excel and find the difference?
Thanks,
Sandhiya P
lakshmi.mp
(Lakshmi Mp)
October 9, 2023, 12:14pm
7
@lrtetala ,
After for each row Assign activity, then if condition placed.
Cannot assign date time to string error getting…
lrtetala
(Lakshman Reddy)
October 9, 2023, 12:14pm
8
Change Data type to System.DateTime @lakshmi.mp
supriya117
(Supriya Allada)
October 9, 2023, 12:17pm
9
Place this in if condition @lakshmi.mp
DateTime.ParseExact(row("End_dateRow").ToString(), "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture) >= DateTime.Now.AddDays(5)
lrtetala
(Lakshman Reddy)
October 9, 2023, 12:19pm
10
@lakshmi.mp
In For Each Row in datatable
Assign: End_dataRow= Datetime.ParseExact(CurrentRow("Column date").ToString, “dd-MM-yyyy”, System.Globalization.CultureInfo.InvariantCulture) DataType:System.DateTime
Assign: CurrentDate= DateTime.Now.AddDays(5) DataType:System.DateTime
In If Condition:
End_dataRow>=CurrentDate
Hope this helps!!
lrtetala
(Lakshman Reddy)
October 9, 2023, 12:22pm
11
@lakshmi.mp
Check on this xaml
BlankProcess12.zip (67.6 KB)
lakshmi.mp
(Lakshmi Mp)
October 9, 2023, 12:33pm
12
@lrtetala ,
Assign: Conversion from string “14-10-2023” to type ‘Date’ is not valid.
Error for current date
Data type is DateTime for Current date
lrtetala
(Lakshman Reddy)
October 9, 2023, 12:39pm
14
@lakshmi.mp
Try this
CurrentDate=DateTime.Now.AddDays(5) DataType:System.DateTime
It is working
lakshmi.mp
(Lakshmi Mp)
October 9, 2023, 12:45pm
15
@lrtetala ,
It’s not filtering full excel sheet data writing into next sheet…
lrtetala
(Lakshman Reddy)
October 9, 2023, 12:46pm
16
@lakshmi.mp
Can you please confirm what you are trying?
If this condition is true
End_dataRow>=CurrentDate
what is the next step
lakshmi.mp
(Lakshmi Mp)
October 9, 2023, 12:56pm
18
Test123 - Copy.xlsx (23.0 KB)
This is the excel file. Please look into it.
Here New column 3 has dates current date + 5 days is the current date.
if New column 3 dates >= current date, needs to be filtered.
Hi @lakshmi.mp ,
If you want to write it like a data table then you have to use Data row and add to data table activity.
Build Data Table
Create an Array
Add data row to data table
Write data table to excel.
Otherwise you can use write cell activity inside for each loop.
Thanks,
Sandhiya P
lakshmi.mp
(Lakshmi Mp)
October 9, 2023, 1:17pm
20
@sandhiya.ppp ,
here data is not filtering, can u guide me on this.
Test123 - Copy.xlsx (23.0 KB)
End date filter.xaml (13.4 KB)