Jump to content
  • 0

Trigger - what is wrong with the last part?


biota

Question

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

 

image.png

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0
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?

image.png.7ebe9a3c0e33a4f041a34da0655de7b1.png

 

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:

6354480

 

Hope this helps!

Link to comment
Share on other sites

  • 0

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. 

 

image.png

Link to comment
Share on other sites

  • 0
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. 

image.png.282d7ffcb65b2d52c8c908d41de08dca.png

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. 

Link to comment
Share on other sites

  • 0

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. 

6356408

 

Link to comment
Share on other sites

  • 0

Hi @cheonsa, no problem at all.

The part below inserts 10 rows from the srcLfwInd_lkp table into the recordsLfwInd-tbl.

image.png.cb85e1ec8a546476637f610627a795ea.png

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!

Link to comment
Share on other sites

  • 0
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.

image.png.cb85e1ec8a546476637f610627a795ea.png

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.

Link to comment
Share on other sites

  • 0
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!

Link to comment
Share on other sites

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...