Delete the database from Mendix apps

920 views Asked by At

I would like to know how I can delete the local database of my Mendix programm.

The background story is that i am calling a webservice to write data to an attribute. So every time the user presses a button, the webservice writes data to the attribute. That leads to many entries with the same value. I already fixed the problem with a validation check but I can't get rid of the entries.

Does somebody know how to delete those?

2

There are 2 answers

1
MWB On BEST ANSWER

If you want to get rid of the existing entries, you can always create a microflow that does retrieves all of them from the database and deletes them. You can create an admin section with a button to run this microflow (if you only need to do this once) or create a scheduled event that runs the microflow (say every day).

3
S. Bruijnis On

This depends on wether you run an in memory database (like HSQL) or a local database server like MS SQL Server or Postgres.

Your HSQL database will be empty on every restart, but with a local database instance it won't. Here you can use the database management tools (PostgreSQL -> PgAdmin, MSSQLSERVER -> Microsoft SQL Server Management Studio) to connect to your database. Once you've done that you will need to find your table (it will be modulename$entityname) and execute a query, e.g. TRUNCATE modulename$entityname if you want to delete all records in the table, or DELETE FROM modulename$entityname WHERE (predicate) if you want to delete specific records.