Hello Everyone,

I am newer. I do exercise TODO app, I try to do function like show list due date for next 7 days
 just like currdate() +7

SyntaxEditor Code Snippet

ToDo.DueDate >=CurrDate() and ToDo.DueDate = AddDays(CurrDateTime(),7)


but it is not work. for my understand, currdate() only shows the day , but adddays shows day and time.

Thank you for your help

Hi Nick Tran,

The data type of ToDo.DueDate is Date and the AddDays() function returns calculated value of  DateTime data type. Use the DateTimeToDate() function for conversion (i.e DateTime -> Date Data type) as mentioned below.

DateTimeToDate(AddDays(CurrDate(), 7))


Update the Filter expression as mentioned below:

Code Snippet

(ToDo.DueDate >= CurrDate()) and (ToDo.DueDate < DateTimeToDate(AddDays(CurrDate(), 7)))


PS - Please note that the mentioned first part of the Filter expression is not correct 

i.e ToDo.DueDate = CurrDate() (you are restricting the result-set record which is having the DueDate equal to current date)

Instead of that, the first part filter expression should be (ToDo.DueDate >= CurrDate())


Hope this helps you!


Regards,

Benjith Sam

Benjith Sam wrote:

Hi Nick Tran,

The data type of ToDo.DueDate is Date and the AddDays() function returns calculated value of  DateTime data type. Use the DateTimeToDate() function for conversion (i.e DateTime -> Date Data type) as mentioned below.

DateTimeToDate(AddDays(CurrDate(), 7))


Update the Filter expression as mentioned below:

Code Snippet

(ToDo.DueDate >= CurrDate()) and (ToDo.DueDate < DateTimeToDate(AddDays(CurrDate(), 7)))


PS - Please note that the mentioned first part of the Filter expression is not correct 

i.e ToDo.DueDate = CurrDate() (you are restricting the result-set record which is having the DueDate equal to current date)

Instead of that, the first part filter expression should be (ToDo.DueDate >= CurrDate())


Hope this helps you!


Regards,

Benjith Sam


Thank Benjith Sam,

I will try it. this is new with me. 

Regards,

Nick Tran

Nick Tran wrote:

Thank Benjith Sam,

I will try it. this is new with me. 

Regards,

Nick Tran

You are welcome, Nick :)

Glad I could be of help!


Regards,

Benjith Sam