March 21, 201213 yr Hi All, I have a database attached to this post that has a relationship between table "HOTELS" and table "TOURSv2". On a layout "ROOMINGLIST" (click on the "rooming" button next to the navigation buttons) I have placed a portal where I'd like to put a script on the blue buttons that deletes the according portal row. Why does the master record get deleted as well when I select a portal row and delete it? I only want the portal row to be deleted. The message asks me if I want to delete "that related record" and when I click yes, the master record on layout "GUIDED TOURS" is deleted as well. I have read the manual, have bought the "missing manual", I have searched the forum and googled the web but I don't seem to be able to get a grip on this. Maybe because it's too simple and the solution is so close... Thanks as always! And sorry about the file size but this thing has grown (on me) since I started it in 2005... >>>>Sorry, but I'm not able to upload the file (20MB) neither as ZIP or unzipped. Andy
March 21, 201213 yr in your relationships, there must be a checkbox which deletes records via this relationship. As portals are showing only related records. Check your Context of the portal using the Relational Graph. that should do it and then you can script the delete by going to record and deleting appropriately. -i
March 21, 201213 yr Check that you are using the "Delete Portal Row" step on the blue button in the portal, and not "Delete Record/Request".
March 21, 201213 yr Author I have done both of the above, my portal row buttons are applied with "delete portal row" and the check box in the relationship graph for the hotel table is checked with delete relayted records through this "relationship". It still deletes the master record in the other table. Also i think itnshould delete the portal row when the checkbox in the graph is not checked. I wish I could attach the file but I've tried three times and each time it wouldn't upload it.
March 21, 201213 yr Is that an empty copy you that you are zipping? Save a copy as 'empty clone' to save space and try it again. When you try to upload, you select the file and then be sure to click the button below that called 'attach file' or it won't attach.
March 21, 201213 yr Author I have deleted all records in the database and just added 4 new ones for the example to work. I also clicked "attach" after I selected my file. I just tried it again and it still doesn't work; it's showing an ERROR saying no file was selected. The upload bar runs very slow, it takes about 2 minutes for the almost 20MB file, when the bar is finished ni file is attached. Is there any other way I can let you see or send the file?
March 21, 201213 yr You are correct, Andy, that what you have checked in your relational graph has no bearing on deleting a portal row. That relation 'delete related records...' checkbox applies to automatic deletion of child records when a parent is deleted. Upon review of your file, you are using a script: If [ "Status(CurrentPortalRow)" ] Set Field [ HOTELS::global ; "Status(CurrentPortalRow)" ] Go To Portal Row [ by calculation ; HOTELS::global ] Delete Record/Request [ no dialog ] End if .. my question is why are you not using a single button step of Delete Portal Row attached to that blue button?
March 21, 201213 yr Author The script is something I have tried to see if it works. But neither the script works nor does the "delete portal row" command on the button delete only the portal row but also the master record.
March 21, 201213 yr I just did it in your file, Andy. I am sending your file back with only the blue button changed - removing your script and attaching button 'delete portal row' You have 14 hotel records (parent) and 3 tour records (child, portal). If you click the blue button in the portal row, you will still have 14 hotel records but only 2 tour records.
March 21, 201213 yr Author After checking you file it did exactly what I tried to avaoid. I have 3 records in hte TOURS table and 14 records in the HOTEL table which contains the portal. When I delete a portal row my record in the TOURS table also gets deleted. You could probably see the intention behind this: all my master records in table TOURS are my customers. Sometimes 2 guys share one room but I have to create one record for each guy. On the hotel layout I then have two portal rows showing for both of these guys, each sharing a room with another. But I do only need one of the records in the portal or the hotel will book two rooms for them instead of one. So I delete one row but I cannot have the related record in my TOURS table related as I then would delete a customer record. Does this make sense?
March 21, 201213 yr My immediate reaction in reading your response was, 'Andy is missing a join table which deletes the 'person/tour record' and not the tour record.' I hadn't looked at your tours table. You have multiple 'like' fields throughout, there appears to be eight of everything. You have 560 fields in the Tours table and you only have three tables. I cannot currently assist, between losing power in a storm and lots to do. I suggest you (at minimum) take those 8 fields, create a related table and turn them into 8 related records. Sorry, I cannot help you with it right now. Hopefully others will step in ...
March 21, 201213 yr Author Thanks LaRetta, I will take a look at this. I know this database needs work done. It has worked for me for several years now but has errors that go back to the time when I started and self-tought FM5 and these bugs I have learned to live with. I hope the power stays on for you now...
April 23, 201312 yr Newbies Why does the master record get deleted as well when I select a portal row and delete it? I only want the portal row to be deleted. The message asks me if I want to delete "that related record" and when I click yes, the master record on layout "GUIDED TOURS" is deleted as well. Real simple, you're allowing records to be deleted in your Master Table and not your Slave table.
April 24, 201312 yr You are correct, Andy, that what you have checked in your relational graph has no bearing on deleting a portal row. That relation 'delete related records...' checkbox applies to automatic deletion of child records when a parent is deleted. Upon review of your file, you are using a script: If [ "Status(CurrentPortalRow)" ] Set Field [ HOTELS::global ; "Status(CurrentPortalRow)" ] Go To Portal Row [ by calculation ; HOTELS::global ] Delete Record/Request [ no dialog ] End if .. my question is why are you not using a single button step of Delete Portal Row attached to that blue button? Delete Record/Request will delete the parent record. You need to delete the portal row.
Create an account or sign in to comment