Jump to content
Server Maintenance This Week. ×

Script to fire only when a value changes


This topic is 3146 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi there

I have a data table consisting of values which are summarised into some very complex reports.  Under normal circumstances, running these reports is time consuming and therefore a poor user experience.  As it happens, 80% of the data on a report is historical and will *mostly* not need evaluating.  Therefore, I've developed a script which runs overnight to create simple values stored in number fields on a related table.   I report from this instead.   This means the report is 80% quicker on loading.

All well and good....but, there is still a chance that data could change in the period between the scripts being run at night.  If the data changes, the related table is then out of date.

What I need is a second, smaller script, very lightweight which will update figures on the related table only if they change by user intervention.  This means they're still accurate and the final reporting is still quick.

The trigger would be something like (psuedo logic):  If (Stored value on the reports table) is not equal to (the summary field it originally came from), then run the update script to make it equal

OR as an alternative

If (value on the data table) is amended today, then run the update script to ensure the reports table number is accurate

I feel there's something I can do with a timestamp routine, but cannot get my head around this.

Thanks in advance

 

 

 

Link to comment
Share on other sites

This topic is 3146 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.