You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ben Spigle <bs...@bigfoot.com> on 2002/07/16 07:01:43 UTC
Passing boolean expresion to a macro
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
RE: Passing boolean expresion to a macro
Posted by Ben Spigle <bs...@bigfoot.com>.
Unfortunately that evaluates outside the macro. I want to pass the Boolean
string and have it evaluate inside the macro. That way it could give me a
different value for each iteration in the foreach loop within the macro...
ben
-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@adeptra.com]
Sent: Tuesday, July 16, 2002 7:48 AM
To: velocity-user@jakarta.apache.org
Subject: Re: Passing boolean expresion to a macro
On 7/16/02 9:43 AM, "Ben Spigle" <bs...@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" <bs...@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:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Passing boolean expresion to a macro
Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 7/16/02 9:43 AM, "Ben Spigle" <bs...@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" <bs...@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:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Passing boolean expresion to a macro
Posted by Ben Spigle <bs...@bigfoot.com>.
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
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" <bs...@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:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Passing boolean expresion to a macro
Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 7/16/02 1:01 AM, "Ben Spigle" <bs...@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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>