Jump to content
  • 0
kpcollier

Tailoring a Trigger to a Certain Field

Question

I have two tables, Est_Table and Job_Table.

Est_Table is filled with a ton of "bids" - Jobs that we are trying to secure. The fields in Est_Table consist of a BidID, Project_Name, Contractor_Name, and a Yes/No for Bid_To_Job (If a bid turns into a job, you check it).

I am trying to set up a trigger in the Est_Table. I need to tailor the trigger to only work when Bid_To_Job is updated. My goal is that when an entry in the Est_Table is updated to a Job, the entry (BidID, Project_Name, etc.) is automatically copied to the Job_Table.

I have it set up so everything copies over to the Job_Table if ANY field is updated in the Est_Table. Also, I am unsure why I can't select the Bid_To_Job field (is it because its a Yes/No data type?).

 

Screenshot (2).png

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hello kpcollier,

Your Bid_To_Job field can be selected even if it is a Yes/No.

I tried it on my end, and it worked. I think, your Job_Table_Example does not have a Bid_To_Job field, that's why you cannot select it.

You can refer to this screenshot for the triggered actions:

image.thumb.png.1ded84d2151dae56ab438656cdfffff8.png

These are the tables that I used:

image.png.c50fad743ed32b4ef1fdf1c98b39a94f.png

image.png.9e0239f70d6ce6d39566bbbb8ce48e29.png.

Hope this helps.

 

-JolliBeng

Share this post


Link to post
Share on other sites
  • 0

@JolliBeng Thank you! That is almost what I need. With the trigger you supplied, an entry from the Est_Table will be copied over if ANY field is updated in the entry. I am trying to make it so only the update of Bid_To_Job copies the entry over. I will be trying to figure this out. Thank you for your help and getting me started!

Share this post


Link to post
Share on other sites
  • 0

While working with this trigger trying to figure out my problem, I thought maybe I could just create a new trigger. The idea of the trigger is that if any unnecessary entry is entered into the Job_Table, it would just be deleted from that table. But for some reason it isn't working.

 

 

Screenshot (3).png

Share this post


Link to post
Share on other sites
  • 0

Thought I figured it out. LOL. Oh well. I entered that trigger I previously posted into the end of the Est_Table trigger, that initially copies over the entries. So, now, it SHOULD work as anything updated gets sent to Job_Table, but anything that doesn't have Bid_To_Job as true is deleted. But, nothing is copying over anymore. On to the drawing board again.

Share this post


Link to post
Share on other sites
  • 0

Hello kpcollier,

If you want to copy all the updated data from EST_Table to Job_Table and delete the data that has a checked Bid_To-Job, you may use this:

image.png.f2d95583d6007c023ff09ad02e1095f4.png

But if you only want to pass the values of the updated data from EST_Table to Job_Table without changing the status the Bid_To_Job on the Job_Table, you just need to remove it on your insert into statement like this: 

image.png.c1a634d5b216ccf9ed299da044df0f9d.png

 

-JolliBeng

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×