We help IT Professionals succeed at work.

Trigger for experts only

akiles99 asked
Last Modified: 2012-05-05
Hello guys,
I have two tables namely conthist and contact2....
I need a trigger when a insert or update in done on conthist it fires the trigger and the values of the column duration in conthist is stored in UYTD column of contact2....COnthist table also has a column named ondate where  sales date are going to be stored...But with more modifications thats why i'm posting this to experts like you...see more details below...

YTD Sales - Trigger name
Purpose: To populate the field with the amount of the year to date sales activity of the contact record.
How: This will come from the history table (ContHist) as the total amount of the last years sales
activity. This would be adjusted for each year going forward and will require the zeroing out of
the data at the turn of the year. This existing data, in UYTD, would be move to the ULYRSALES
on the first day of the new year.
Using a RecType Code of S and the DURATION field as the amount.
Update the UDF of Contact2 named UYTD
Note: There will be more than one sale item on any given date, as the items are entered into the database
as single line items; but all on one quote/order. You must be able to aggregate the total amount of
the sales and display that aggregated total in the UYTD field...

If a set of sales occured before 1/1/2008, then it would not be part of this year to
date sales....
According to the specs, the data would move to the ULYRSALES field
when the System date turned past 1/1/2009 .

ALso in same trigger i need a nested onewhich increment up by 1 day every day that lapse past the last
sale date....

Watch Question

Please provide the structure of the tables ... and a few rows of sample data.




I attached the structure of the table and some sample values ...the contact2 table has values same as conthist for the first 2 fields...
for 3 &4 only we have to write a tigger....
This one is on us!
(Get your first solution completely free - no credit card required)


Thanks for ur time mr.Danielwilson ...I test it and let u know...



Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.