Jump to content
  • 0

Trigger to create for all active field


Go to solution Solved by CoopperBackpack,

Question

Hi there, I am relatively new here with my first post. I am busy figuring out trigger actions which I have the basics down but struggling with something:
I have 3 tables:
1. user_info
2. trading_results
3. user_history

I need a trigger action to insert newly captured data from trading_results (date, growth in %) to user_history applying it to all active users (tick box) from the user_info table.

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 1
  • Solution

Hello @Benades,

This information is helpful. As I understand now,  you need to insert new records (not to update the existing) to the user_history table every time the new record is inserted to the trading_results table.

Let`s say I have the following user_info table:

mKgQaNg.png

 

And insert data to the trading_results table: growth - 100, date - 04/15/2021

I receive the following result:

CStyryE.png

 

The Trigger design:

ksnelkZ.png

Not sure that this is  the result that you are looking for. 

And if it is the case, maybe some can provide you with more elegant solution. 

Link to post
Share on other sites
  • 0

Hello @Benades,

If I understand correctly, the user_history is initially empty.  And you need to add there the data that is inserted to the  trading_results table. 

And tables are linked with user_id like this: 

1WKFFUf.png

If all above is correct, you may try to build the following Triggered Action:

ezMRh1h.png

The idea is to create a trigger on the trading_results table that is running on the Insert action. 

You need to have Inner Join for #inserted table and the user_info table on user_id to check the the user status.  And insert the values from #inserted table to the user_history table.

Hope this helps. 

Link to post
Share on other sites
  • 0

Thanks for the feedback @CoopperBackpack but I was looking for something more automatic. In my case there is no user_ID in the trading_results table because there are 100's of users and adding users by the day. So I want the trading results from the table to apply to each and every active user each time a new trading results is inserted.

The loops trigger sounds to be going in the right direction logically speaking 'for each record in {trading_results} do {apply to users_info_active}

Link to post
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...