[Solved] Help preventing deletion in a table or form via Tri

Creating tables and queries
Post Reply
gkick
Posts: 324
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

[Solved] Help preventing deletion in a table or form via Tri

Post by gkick »

Hi,

Is it possible to use a BEFORE DELETE Trigger in an HSQL2.5 backend based on a particular criteria and display a messagebox that this record can not be deleted and leaving the record(s) in place?

Example ... any invoice where payment > 0 can not be deleted

Thanks
Last edited by gkick on Sun May 24, 2020 4:29 am, edited 2 times in total.
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Help with preventing deletion in a table or form via Tri

Post by Villeroy »

Referencial integrity does that by default. Having a 1-n relation between a table of payments (n) and a table of invoices (1) you can not delete any invoice having an entry in the payments table.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Sliderule
Volunteer
Posts: 1278
Joined: Thu Nov 29, 2007 9:46 am

Re: Help with preventing deletion in a table or form via Tri

Post by Sliderule »

gkick wrote:Is it possible to use a BEFORE DELETE Trigger in an HSQL2.5 backend based on a particular criteria and display a messagebox that this record can not be deleted and leaving the record(s) in place?

Example ... any invoice where payment > 0 can not be deleted
Yes.
gkick
Posts: 324
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: Help with preventing deletion in a table or form via Tri

Post by gkick »

Thanks gentlemen!
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
Post Reply