Deleting data using OQL

0
Good day I have encounter a problem where my mendix data table is populating faster than the xpath retrieve and delete microflow is cleaning up the table. Now I am wondering if it is possible to use OQL to clean up the table, Using OQL I was able to retrieve the data I wanted to delete from the table. But can I just create an OQL that deletes that data without retrieving. Is this possible? Or is their an alternative?
asked
3 answers
2

No, OQL is read-only. So that is not an option.

There are several alternatives, of which creating a java-action is one. Take a look at ObjectHandling’s ‘deleteWithoutEvents’ for inspiration. And use library java.SQL.

Another one is importing a SQL-module. None is available on Marketplace, but maybe you have access to one of your company.

Do make sure your objects have no events and deletion-behavior, because that will get skipped.

answered
0

Hi Rick,
As far as I know it is not possible to use a delete query in OQL.
You can check it by yourself in the beautiful app : https://service.mendixcloud.com/p/OQL

answered
0

Where is the application hosted ? 
If it is in Mendix cloud , you will not be able to use SQL Script in Java Action, since user name password will not be shared as per the policy.

If OnPremise:
I would suggest to use Database Connector module from Market to execute the queries ( Instead of a Custom Action)

Module : https://marketplace.mendix.com/link/component/2888

 

My suggestion is to retrieve from Data and Delete in a microflow. Safe and Best one!!

Hope this helps!!

answered