[ic] Set variable to query result at start-up?

Bill Carr bill at worldwideimpact.com
Thu Feb 14 13:51:55 EST 2008

On Feb 14, 2008, at 1:00 PM, Jeff Boes wrote:

> I'm curious if anyone's done this before, and if there are any  
> clever or
> canned approaches:
> I would like to initialize an Interchange variable to the result of a
> SQL query, at IC startup (because the query could be a bit costly to  
> run
> per page or even per session). Specifically, I want to set:
> to the first year represented by transactions.order_date, e.g.,
> select min(to_date(order_date,'YYYY')) from transactions;
> The only approach I've thought up (which I haven't tried yet) would be
> to define a module with a BEGIN block[1], and "Require" it in the
> interchange.cfg or catalog.cfg. Are there other approaches?
It's not fancy but we just run a perl script to generate our  
catalog_befores for each catalog. It allows us to do stuff like above  
and more. We keep many site settings in a configuration table editable  
via an Interchange based UI by non-technical people. We simply call  
our "make_ic_configs.pl" script from out interchange startup script.  
We do a similar thing with Apache.

Bill Carr
bill at worldwideimpact.com

More information about the interchange-users mailing list