You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "WATKINS, Andy, FM" <An...@rbos.com> on 2002/02/05 15:53:43 UTC

Bug in macro evaluation when

For developing reports we place the sql inline. When the report
has been finalised, we write a servlet to populate the context (MVC
paradigm).

However we are having problems with local velocity macros getting cached.

The code below uses a macro to hold the sql statement. By "evaling"
this (using "#transactionList()" ) we get around the problem that velocity
does not permit multi-line #set statements.

When we set
 	velocimacro.permissions.allow.inline.local.scope=true

the eval stops working, and just returns "#transactionList()" as text? Is
this a bug?

Andy



#macro( transactionList )
  select
    st.value_date as valueDate,
    c.counterparty_name as counterparty, Y
    st.scheme_buy_currency_code buyCcy,
    st.scheme_buy_amount as buyAmount,
    st.scheme_sell_currency_code as sellCcy,
    st.scheme_sell_amount as sellAmount,
    srq.all_in_rate as allInRate,
    st.scheme_transaction_id as schemeTransID,
    st.transaction_id as fxmpTransId,
    st.transaction_datetime as transDateTime,
    st.acceptance_status as status
  from
    scheme_transaction st,
    counterparty c,
    scheme_rate_quote srq
  where
    st.counterparty_id_one = c.counterparty_id and
    srq.scheme_rate_quote_id = st.scheme_rate_quote_id
  order by
    st.value_date,
    c.counterparty_name,
    st.scheme_buy_currency_code,
    st.scheme_sell_currency_code
#end

#set ($results = $report.createBySql("#transactionList()") )



********************************************************************
      Visit our Internet site at http://www.rbsmarkets.com

This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
********************************************************************

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Bug in macro evaluation when

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 2/5/02 9:53 AM, "WATKINS, Andy, FM" <An...@rbos.com> wrote:

> For developing reports we place the sql inline. When the report
> has been finalised, we write a servlet to populate the context (MVC
> paradigm).
> 
> However we are having problems with local velocity macros getting cached.
> 
> The code below uses a macro to hold the sql statement. By "evaling"
> this (using "#transactionList()" ) we get around the problem that velocity
> does not permit multi-line #set statements.
> 
> When we set
> velocimacro.permissions.allow.inline.local.scope=true
> 
> the eval stops working, and just returns "#transactionList()" as text? Is
> this a bug?
> 

:)

Yes, maybe.

1) What version of Velocity?

2) You don't want local.scope, but rather

 velocimacro.permissions.allow.inline.to.replace.global = true

If I understand what you are trying to do...

geir

> Andy
> 
> 
> 
> #macro( transactionList )
> select
>   st.value_date as valueDate,
>   c.counterparty_name as counterparty, Y
>   st.scheme_buy_currency_code buyCcy,
>   st.scheme_buy_amount as buyAmount,
>   st.scheme_sell_currency_code as sellCcy,
>   st.scheme_sell_amount as sellAmount,
>   srq.all_in_rate as allInRate,
>   st.scheme_transaction_id as schemeTransID,
>   st.transaction_id as fxmpTransId,
>   st.transaction_datetime as transDateTime,
>   st.acceptance_status as status
> from
>   scheme_transaction st,
>   counterparty c,
>   scheme_rate_quote srq
> where
>   st.counterparty_id_one = c.counterparty_id and
>   srq.scheme_rate_quote_id = st.scheme_rate_quote_id
> order by
>   st.value_date,
>   c.counterparty_name,
>   st.scheme_buy_currency_code,
>   st.scheme_sell_currency_code
> #end
> 
> #set ($results = $report.createBySql("#transactionList()") )
> 
> 
> 
> ********************************************************************
>     Visit our Internet site at http://www.rbsmarkets.com
> 
> This e-mail is intended only for the addressee named above.
> As this e-mail may contain confidential or privileged information,
> if you are not the named addressee, you are not authorised to
> retain, read, copy or disseminate this message or any part of it.
> ********************************************************************
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
POC lives!


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>