[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


Rick Bragg <suppressed> wrote:
> On Thu, 2008-02-14 at 13:00 -0500, 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:
> > 
> > UI_DATE_BEGIN
> > 
> > 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?
> > 
> > 
> > [1] I'm not entirely sure this would run at the appropriate point, i.e.,
> > after the database connection is established.
> > 
> Take a look at [timed-build]....
> 
That would work if the variable was going to be used as
__UI_DATE_BEGIN__.

In this case, it's more likely that the variable will be used as
$::Variable->{UI_DATE_BEGIN}, in the Vend::Form module, and so the
[timed-build] tag would not be interpolated.

It's still a good suggestion that would be useful in most other
situations.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    suppressed
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/
_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.