On Nov 1, 2016, at 7:23 PM, David Adams wrote:

> Who knew? Great trick. A good alternative (but more complicated) is to use
> a memory-based message queue and send all of the log data to a single
> process that has the file open. This is a perfect use of CALL WORKER.

Yes, I agree. 

> I gave up on complex triggers in 4D years and versions ago ;-(

Most are less than 10 lines of code. And the few that call methods the called 
methods are under 100 lines total. 

They mostly just assign values to fields like:

Case of 
   : (Trigger event=On Saving New Record Event)
      If ([CaseActivityNotes]CreateDate=!00/00/0000!)
         [CaseActivityNotes]CreateDate:=Current date
      End if 
      If ([CaseActivityNotes]CreateTime=?00:00:00?)
         [CaseActivityNotes]CreateTime:=Current time
      End if 
      If ([CaseActivityNotes]CreatedBy="")
         [CaseActivityNotes]CreatedBy:=Current user
      End if 

   : (Trigger event=On Saving Existing Record Event)
      [CaseActivityNotes]UpdateDate:=Current date
      [CaseActivityNotes]UpdateTime:=Current time
      [CaseActivityNotes]UpdatedBy:=Current user
End case 

AddRecordChangesLogEntry2 (Trigger 
event;->[CaseActivityNotes]CaseNumber;->[Patients])

Does that appear “complex” to you? 

I like to guarantee that some field get exactly what I want in them regardless 
of who or what changes a record. Seems like a proper use of triggers.

> Not necessarily applicable in your case, but do you have a way of storing
> summary data for reporting purposes that is accurate (enough) for you
> needs? I'm big on well-normalized structures (ever more so)...but I don't
> see all tables as relational. Lots of data analysis tools use very
> different topologies and rules for the purposes of reporting. I don't mix
> extract data and live data in the same tables, but I definitely have tables
> that are pre-renderings of complex calculations. That's about the only way
> to make some reports feasible in, for example, a Web environments. Lots of
> us have data that is 100% static - like past quarterly data. It isn't even
> allowed to change. Grind it up and boil it down!

In this case it would be difficult to summarize the data in all the possible 
query options users have.. It could be done but you’d have to store so many 
different totals for so many different option combinations s it just seemed 
like more work than it was worth for the time saved. I’m not talking about 
saving hours to do a report, I’m down to trying to shave off a few minutes. 

And with normalized data that’s one less stored procedure that has to run every 
night to update the totals. I’m sure E.F. Codd is smiling right now. :)

> Cool, please report back on what you find. There will also be a break-even
> point for the extra hassle of marshalling all of those services, so  you
> may get some real-world sensitivity for that.

The good news these are regularly run reports so we know how long they take on 
average. I can easily put in some debug code to let me run the same report 
calling the old method and the new method that is preemptive. And this is 
really just a way for me to try out this new preemptive stuff. I always like to 
program with a purpose. 

Tim

********************************************
Tim Nevels
Innovative Solutions
785-749-3444
[email protected]
********************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to