The Robertson Team


  Programmers' Tools >  The Free Stuff >  GridMonger >  FAQ >  How do I plug in my own custom processing with the code include feature?

How do I plug in my own custom processing with the code include feature?

Starting with v4.31 GridBuilder allows you to write up your own ColdFusion templates to be plugged in during GridMonger's processing.  You can specify two different templates in a grid config file.  One template fires on an INSERT operation, and the other fires on UPDATEs.  There are two demo files included:

  1. /includes/gm_userdefined_insert.cfm
  2. /includes/gm_userdefined_update.cfm

You can specify any file name you want in the grid config file.  These are provided solely for the comments they contain inside.

These are extremely handy as you can thus take advantage of everything in memory at a given moment to provide custom processing of your data.  For example, you need to insert a record, but you have a field that must be stored which contains a calculated value based on two other fields you entered, plus a third factor taken from an application variable.

If all you wanted to do is display a value, you could use GridMonger's Calculated Columns feature.  However if you want the data to be sortable in the grid, and/or stored permanently, a calculated column won't work.

There are instructions in each of the sample demo files that describe easy ways to pull data out of your application (i.e. figuring out the primary key of the record you just inserted without using dangerous procedures like the infamous SELECT MAX method).  Additionally, GridMongers Hidden Input Fields feature is your friend when doing inserts.  Any hidden input field value is now copied to the form scope so it is available to you during your custom post-processing.  To accomplish the same thing during an UPDATE, include your necessary values via the separate Hidden Fields feature.

The Robertson Team,
1.559.360.1717 is a leader in ColdFusion web hosting and managed dedicated servers.