HI,
I have three linked grids keeping track of some equipment.
The Parent grid contains the details on the equipment; one linked grid with details on maintenance carried out on the equipment, another linked grid with details of files that have been uploaded containing information about the equipment.
All works perfectly.... however, my question is, when you delete a record from the parent table I want all the related records from the children tables to be deleted also + the actual files stored on the server.
I have been attempting to create a server side event in the AfterDeleteRecord, but I'm quite unfamiliar with xbasic...
I thought that the code needs to:
- check if I am deleting from the parent grid or the child grid, if the parent then delete the children records.
- I though I could check this by determining if the PK = 'the name of the PK in the parent table'
- If true then simply delete all records in the child tables, filtering where the id = the id of the record in the parent table that I'm deleting.
Not sure how to go about deleting the files though.
Any assistance would be greatly appreciated....
dim ID as c
ID = tbl.Idequipmentlist
If(e.primaryKeyArray[1]="Idequipmentlist",record_delete("ft_equipment_list_files","Idequipmentlist = ID"),"")
If(e.primaryKeyArray[1]="Idequipmentlist",record_delete("ft_equipment_maint_record","Idequipmentlist = ID"),"")
Cheers
Craig
PS. I have been using wiki as my xbasic knowledge base and appreciate that I need to get skilled up in this area, do you have anyone recommend any good resources?
I have three linked grids keeping track of some equipment.
The Parent grid contains the details on the equipment; one linked grid with details on maintenance carried out on the equipment, another linked grid with details of files that have been uploaded containing information about the equipment.
All works perfectly.... however, my question is, when you delete a record from the parent table I want all the related records from the children tables to be deleted also + the actual files stored on the server.
I have been attempting to create a server side event in the AfterDeleteRecord, but I'm quite unfamiliar with xbasic...
I thought that the code needs to:
- check if I am deleting from the parent grid or the child grid, if the parent then delete the children records.
- I though I could check this by determining if the PK = 'the name of the PK in the parent table'
- If true then simply delete all records in the child tables, filtering where the id = the id of the record in the parent table that I'm deleting.
Not sure how to go about deleting the files though.
Any assistance would be greatly appreciated....
dim ID as c
ID = tbl.Idequipmentlist
If(e.primaryKeyArray[1]="Idequipmentlist",record_delete("ft_equipment_list_files","Idequipmentlist = ID"),"")
If(e.primaryKeyArray[1]="Idequipmentlist",record_delete("ft_equipment_maint_record","Idequipmentlist = ID"),"")
Cheers
Craig
PS. I have been using wiki as my xbasic knowledge base and appreciate that I need to get skilled up in this area, do you have anyone recommend any good resources?
Comment