Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Sat
17
Views
22
Comments
Solved
delete old data
Question
Usability
after 30 days i want the old data to be automatically deleted .. how do i go about doing this...
( Outsystems vs 8)
Gonçalo Azambujo
Solution
Try to understand the pictures I let.
Any doubt ask.
See solution in context
DeleteExample.PNG
Gonçalo Azambujo
Hi Sat,
I think you can build a user action to do that and then add a timer in the "processes" tab, schedule him to execute the action you builded in the day of the month you want.
Best regards.
Sat
Thank-you this is exactly what i have been trying to do.. as an inexperienced developer/ outsystems developer is it possible to provide me with a step by step guide ?
Kind Regards
Sat
I have tried this but it doesnt seem to work.. what is it that i am doing incorrectly ?
delete old data.docx
Gonçalo Azambujo
Hi Sat,
I let an example showing what I think it's a best approach to what you want to do.
I created a logic action, then I set a timer to run that action in the last day of every month.
The action will delete the records from the table for the last 30 days.
If you liked this approach try adapt for what you want.
Best regards.
Example.oml
Sat
I cannot open the link as i am working on version 8
Gonçalo Azambujo
Solution
Try to understand the pictures I let.
Any doubt ask.
DeleteExample.PNG
Sat
This helps thank -you.. as an inexperienced developer... i have a few questions
is this an action within the logic function
what sql code you input into the SQL advanced query
Gonçalo Azambujo
1) Yes, because to use an action on a timer it's have to be a logic user action.
2)equal to yours, but with (-30) on second adding days attribute. Because we want the last tirthy days right?
Gonçalo Azambujo
Already anwsered on my last post.
Sat
Thank-you i will try it shortly - yes it was -1 so i could test it :)
Sat
This doesnt work...Is there something i am missing ...please see screen shots
delete old data 2.docx
Gonçalo Azambujo
Hi Sat,
in third picture, you have a query with "DELETE from...." you must have "SELECT from...". The action to delete data will take effect on the action "DeleteEventCalendar" that you have in your "For Each" cycle.
Pay attention to your schedule, because exist months that don't have 31 days...like the next February, so if you say that the action must be taken in 31º day of every month, at some months these action will not have effect....
Best regards,
Sat
Thanks - I didnt think of the days thing i thought it would automatically calculate 30 days ... if i change it to 27 i should be covered ?
when i put in SELECT it come up with a warning message ... ref attachment
delete old data 3.docx
Gonçalo Azambujo
If you change to 27 it should be covered yes.
In your query, after the SELECT, you must set at least one attribute from your entity that query must search for, like ex: name, date, etc...
Gonçalo Azambujo
other thing...in your expression you must change "Add(CurrDate(),-30)" to "
DATEADD
(
day
,
-
30
,
Getdate
())"
Sat
I am still getting errors
I think i may be over complicating this process a little bit...
I have an entity called DateTime - this is where the user enters the date of an event
once the event date has passed i want the event to be automatically deleted from the list
Gonçalo Azambujo
Deleted from the list (don't show) or from your database? The approach it's different for both situations.
Sat
From both?
Gonçalo Azambujo
From a Record List it's simple, you have to put a clause in your query, that you use to populate your record list, for only show the dates from the last 30 days.
To delete the data from your entities, the approach it's what you are trying to implement...
can you be more specific where are the problems? The queries don't produce results? or you have results on the queries but you can not delete them? Can you send .oml file for we take a look an try to figure where is the problem?
Sat
when the date has passed i want the event to be deleted .. please see screenshot i hope this help...
Old data.docx
Gonçalo Azambujo
If i understood you want that the list only show the present and upcoming events right? So in query you use to populate that list you have to put a clause, for example,"dateTime>=GetDate()" so that only the current date and upcoming dates are shown in your list.
Sat
so would this go in the preperation of the page
and what exactly should the query state
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
 Loading...