I have produced a Job Tracking solution for a client that has a number of relationships eg Job > Hours | Job > Expenses etc etc. Each record has a number of calculations for fee values and summary fields. In each case I have added a facility to delete a record ie remove hours from a job.
The PROBLEM is that the delete function has stopped working for some reason ie you can’t delete from my script OR from the Servoy delete icon even on a new form, with in this case hours.
My understanding is if you have hours related to a job and create a script with
forms.Job_detail.job_to_hours.deleteRecord();
This should remove the hours related to the job - provided the delete facility has been enabled in the relationship. There are no events affecting this.
Going back to basics I have created an hours layout to see if I can use the Servoy delete icon and again this is not allowing delete to work. My concern is that if this is related to a calculation how do you remove records and still use the calculations to provide results eg total hours per job or for that matter aggregates of specific fields !
This may be super obvious, but I have to admit I am stumped! So any help would be appreciated
For example, are there any related records for hours which it is the parent of (maybe: hours → staff or hours → expense)?
In 3.5 the relation options have changed to include an ‘allow parent delete when having related records’ choice - so if this is deselected in any relationship from the hours table then it will not allow deletes to take place in the hours table !
So you may want to review the relation options for all associated relations not just the jobs->hours
For example, are there any related records for hours which it is the parent of (maybe: hours → staff or hours → expense)?
In 3.5 the relation options have changed to include an ‘allow parent delete when having related records’ choice - so if this is deselected in any relationship from the hours table then it will not allow deletes to take place in the hours table !
So you may want to review the relation options for all associated relations not just the jobs->hours
Cheers
Harry
Thanks very much Harry - this was in fact the problem and I had not fully appreciated that any table affected within a relationship needed to have the “allow parent…” checkbox checked or it would override not only my script but Servoy’s functions too !
For example, are there any related records for hours which it is the parent of (maybe: hours → staff or hours → expense)?
In 3.5 the relation options have changed to include an ‘allow parent delete when having related records’ choice - so if this is deselected in any relationship from the hours table then it will not allow deletes to take place in the hours table !
So you may want to review the relation options for all associated relations not just the jobs->hours
Cheers
Harry
Thanks very much Harry - this was in fact the problem and I had not fully appreciated that any table affected within a relationship needed to have the “allow parent…” checkbox checked or it would override not only my script but Servoy’s functions too !