biota Posted March 20 Report Share Posted March 20 Hi all So the Insert block is triggered by any new record inserted to the Table. It then inserts/copies around 18 rows from another table into this one. The Set block is supposed to insert the report_ID of the table row that triggered the action. However I can't get the last section to work, which leaves all the inserted rows 'orphaned'. Can anyone see the issue? Thanks in advance Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted March 20 Report Share Posted March 20 1 hour ago, biota said: Hi all So the Insert block is triggered by any new record inserted to the Table. It then inserts/copies around 18 rows from another table into this one. The Set block is supposed to insert the report_ID of the table row that triggered the action. However I can't get the last section to work, which leaves all the inserted rows 'orphaned'. Can anyone see the issue? Thanks in advance Hi @biota, Based on what I understand, you would like to update the Report_ID of the inserted records. May you please try to use #inserted instead of recordsLfwInd_tbl_1? For example: Hope this helps! biota 1 Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted March 20 Report Share Posted March 20 To add to my previous comment, The #inserted table represents data that is being inserted or updated in the table. You may check this video for more Trigger samples: biota 1 Quote Link to comment Share on other sites More sharing options...
0 biota Posted March 20 Author Report Share Posted March 20 Hi @cheonsa, thanks. That is how I originally set it, but that does not work. In fact when that way it only allows me to select from the #inserted table on both sides of the update? I am trying to update the same tables that the records are inserted into, in the block above this one. Quote Link to comment Share on other sites More sharing options...
0 biota Posted March 20 Author Report Share Posted March 20 8 minutes ago, biota said: Hi @cheonsa, thanks. That is how I originally set it, but that does not work. In fact when that way it only allows me to select from the #inserted table on both sides of the update? I am trying to update the same tables that the records are inserted into, in the block above this one. This is a different table to the one that triggers the action. As I understand it, #inserted relates to the original table into which data was inserted to trigger the action. Quote Link to comment Share on other sites More sharing options...
0 biota Posted March 20 Author Report Share Posted March 20 This is all part of a larger block, and I wonder whether this is conflicting? I know we can only trigger one action though. It feels like maybe this update block should be part of the insert bloc Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted March 21 Report Share Posted March 21 Hello @biota, Sorry for the confusion. I thought that recordsLfwInd_tbl_1 is the same Table where you have the Triggered Actions. By the way, you are correct that #inserted relates to the original table into which data was inserted to trigger the action. In this Inner join, can you confirm that there matching records between the two tables? You are using the Report_ID field to join the Tables, and this is also the field that you are updating. biota 1 Quote Link to comment Share on other sites More sharing options...
0 biota Posted March 23 Author Report Share Posted March 23 Hi @cheonsa, no problem at all. The part below inserts 10 rows from the srcLfwInd_lkp table into the recordsLfwInd-tbl. At that point there is no matching field between the two tables. I need the trigger to enter Report_ID from the #inserted table into the recordsLfwInd-tbl, which is why I joined them on that field. This would be a M2M relationship I suppose. One Report_ID can have many entries in the recordsLfwInd-tbl. For the join, I have tried it all ways but still didn't seem to work. Thanks again! Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted March 23 Report Share Posted March 23 6 hours ago, biota said: Hi @cheonsa, no problem at all. The part below inserts 10 rows from the srcLfwInd_lkp table into the recordsLfwInd-tbl. At that point there is no matching field between the two tables. I need the trigger to enter Report_ID from the #inserted table into the recordsLfwInd-tbl, which is why I joined them on that field. This would be a M2M relationship I suppose. One Report_ID can have many entries in the recordsLfwInd-tbl. For the join, I have tried it all ways but still didn't seem to work. Thanks again! Hello @biota, Joining them with Report_Id could be the reason why the trigger is not working, as you mentioned, it is blank initially. And the Report_ID value will be coming from the projectReports Table. Are there any fields that you can use from the inserted Table to match in the projectReports Table? Maybe you can use that in the inner join instead. Quote Link to comment Share on other sites More sharing options...
0 biota Posted March 23 Author Report Share Posted March 23 28 minutes ago, cheonsa said: Hello @biota, Joining them with Report_Id could be the reason why the trigger is not working, as you mentioned, it is blank initially. And the Report_ID value will be coming from the projectReports Table. Are there any fields that you can use from the inserted Table to match in the projectReports Table? Maybe you can use that in the inner join instead. Hi @cheonsa that one is the #inserted table. Quite the dilemma it seems! Quote Link to comment Share on other sites More sharing options...
0 biota Posted March 23 Author Report Share Posted March 23 It is looking like I need a different solution. I am going to make a new post asking for suggestions. Thanks for your help @cheonsa! cheonsa 1 Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted March 23 Report Share Posted March 23 Hi @biota, You can also open a ticket for the support team to take a look at it further. https://tickets.caspio.com/ They are great with Triggers! biota 1 Quote Link to comment Share on other sites More sharing options...
Question
biota
Hi all
So the Insert block is triggered by any new record inserted to the Table. It then inserts/copies around 18 rows from another table into this one.
The Set block is supposed to insert the report_ID of the table row that triggered the action.
However I can't get the last section to work, which leaves all the inserted rows 'orphaned'.
Can anyone see the issue?
Thanks in advance
Link to comment
Share on other sites
11 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.