Hello
Need to get the older Date from the Current Date. (Output Format- DataTable)
Here Same Input and Output
Sample.xlsx (5.3 MB)
Hello
Need to get the older Date from the Current Date. (Output Format- DataTable)
Here Same Input and Output
Sample.xlsx (5.3 MB)
Hello @Marian_B ,
You can use the below .Select method to filter the DataTable and get older date records.
dt_Output = dt_Input.Select(“[Date]<'”+Now.ToString(“dd-MM-yyyy”)+“'”).CopyToDataTable()
Please refer the below screenshot, this may help you to resolve the error.
Use .Select method as given below
Not Working @rohith.prabhu Getting all the value in the Dt
Mariana,
The solution will work to get all records older than current date. However in your excel file all the records having older dates hence you are getting all records in output.
Add some records of today’s date & future dates and verify.
Also if you want to filter it out for any other date rather than current date please substitute your required date value or variable in place of Now.ToString("dd-MM-yyyy)
No t the current Date, It should be Current Month. I have tested it But it getting all the records @rohith.prabhu
DateFilter.zip (77.3 KB)
Hello @Marian_B , Please refer this Flow, You may got some idea.
Regaerds,
Gokul
To get date older than current month use the below
Input_DT.Select(“[Date]<'”+Now.ToString(“MM-yyyy”)+“'”).CopyToDataTable
(As your data is formatted to Date format in excel file, it will work for your excel file)
It is getting all the records @rohith.prabhu
Hi @Marian_B ,
Could you Check the below Expression :
Input_DT.AsEnumerable.Where(Function(x)CDate(x("Date").ToString).Month<Now.Month).ToArray
Also you would need to follow the below Post to handle the Errors when you convert directly the Filtered Datarows into Datatable.
There might be additional conditions that need to be added if there are multiple date formats/Empty values or change the CDate()
to DateTime.ParseExact()
to get the appropriate results.
Let us know if the expression doesn’t work, we can change the expression according to the results or the Error Message you receive.
Maybe the requirement is different than what it seems, From the Output we can see that the date 11/07/2022 is not present. We would require to know what is the logic you have used
Here is the workflow
OlderDate.xaml (7.5 KB)
Input -
Sample.xlsx (5.3 MB)
I need to Get the Older Dates than the current month in the Date column
Filter expression is not working
It seems that you have eliminated all the dates of the Previous Month as well as per the Output. So is the Logic actually to keep only the Dates lesser than (Current Month - 1) meaning dates lesser than July ?
Then maybe check the below modified Workflow if it reflects what you actually require. Let us know if this is not the required approach.
OlderDate.xaml (8.1 KB)
Hey @Marian_B
You will need to get all the older dates which is not in Current Month - Is that correct ?
Thanks
#nK
Requirement is Eliminate all the date which are older @supermanPunch.
Need to keep Current Month and greater Month only
Current month or Greater Month @Nithinkrishna
@Marian_B , The Sample Output you have provided doesn’t meet this requirement.
Needed only the Eliminate Month @supermanPunch , So the Output looks like Only eliminated Month
Apologies for the wrong input file Here is the correct one @supermanPunch
Sample.xlsx (5.3 MB)
Have you Checked if the above workflow that I have provided, gives you the required output for this input file ?
Let us know if it doesn’t provide the same Output.