velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@adeptra.com>
Subject Re: Passing boolean expresion to a macro
Date Tue, 16 Jul 2002 13:48:20 GMT
On 7/16/02 9:43 AM, "Ben Spigle" <bspiglejr@bigfoot.com> wrote:

> Sure.  Here's the macro
> #macro(test $includeIf $fields)
> #foreach($field in $fields)
> $field.Name $includeIf
> #end
> #end
> 
> Here's how I called it
> #test("!$field.Column.Identify && !$field.Column.ViewColumn"
> $element.Fields)
> 
> Here's the output
> SiteId !True && !False
> Address1 !False && !False

Not a surprise, as you passed it a string

How about

#set($val = !$field.Column.Identify && !$field.Column.ViewColumn)
#test($val $element.Fields)


> 
> Thanks!
> 
> ben
> 
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@adeptra.com]
> Sent: Tuesday, July 16, 2002 4:07 AM
> To: velocity-user@jakarta.apache.org
> Subject: Re: Passing boolean expresion to a macro
> 
> On 7/16/02 1:01 AM, "Ben Spigle" <bspiglejr@bigfoot.com> wrote:
> 
>> I have a macro which I am trying to pass an anded list of Boolean
>> properties like !$field.ViewColumn && !$field.IsPrimaryKey.
>> When I pass these in quotes the parameter ends up having a value like
>> "!False && !True".  This is so close to what I want
>> (i.e. Boolean false in this case) that I was hoping someone could give
>> me an idea of how to make that next little step.
>> 
>> ben
>> 
> 
> So close, yet so far.
> 
> Can you show us how you are doing it?
> 
> --
> Geir Magnusson Jr.
> Research & Development, Adeptra Inc.
> geirm@adeptra.com
> +1-203-247-1713
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:velocity-user-help@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:velocity-user-help@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message