I have a date filter where there is from and to date my TO date is the current date, but i want my FROM date to be 1 week before the current date is there a way to execute this? i tried the adddays(currdate(), -7)
Hi Jesus Carlos,
Oninitialize action of screen
Set the date variable
As datetimetodate(currdate(),-7)
Hope this helps
Prince
Thanks for replying and im new to outsystem can you tell me where is the on initialize ? thank you
Select the screen and check into the properties section and select the actions for the events oninitialize action.
thank you for pointing it out but the error says "Too many arguments specified for function 'CurrDate'. "
sorry my bad. i forgot to write this exactly what it should be
DateTimeToDate(AddDays(CurrDate(),-7))
Hello Jesus,
Usually filters are on the screen to allow users to change the values. However, in your case it seems you are fixing the date range to past one week, they you probably don't even need the date filters on the screen. You could simply provide a selection "Last Week", when user selects it you perform the date range calculation in your logic and fetch the data accordingly.
Hope it helps!
Junaid
Hi Jesus,
You can use date picker and set the initial date as AddDays(CurrDate(), -7)
Hope this will help you.
Thanks for the help but this time i dont use date picker only input date time type
If your To and From date values are fixed, i.e. currentDate and 7 days before current date, then you should follow the approach that Junaid suggested.
Just assign the values in your logic for ToDate=Currdate() and FromDate=adddays(currdate(), -7) .
Hope it helps.
Thanks
to date currdate works but the FromDate=adddays(currdate(), -7) . doesnt work. thanks
Can you please help me to understand the error or problem you are facing while using adddays function?
it doesnt add anything or subtract anything just the month and time format displayed
can you please show me how are you using it with the help of a screen shot?
it works like this.
FormatDateTime(AddDays(CurrDate(),-7),"dd/MM/yyyy") => Use this expression in the To field.
Make Sure, Don't use input box use expression. Thanks
im putting this code to the prompt and it does not work. thanks
can you please share some screenshots.where exactly you are facing this problem.
Use the screen "OnReady" event and assign "FromDate" as below using "Todate" having Defaultvalue as CurrDate().
Also similar logic/assignment can be used in "OnChange" event of "ToDate" input widget to get new "FromDate" value as per value selected in "ToDate" input.
Please check below demo:
https://personal-49wyaomr.outsystemscloud.com/ReactiveAppDemo_Th/DateDemo