Compare null

2004-10-06 Thread Manish
How can I compare 'null' in my velocity template for if condition???
The following results in an error.

#if(null == $p.getDisplayaddressbool()){
}

TIA,
- Manish


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Compare null

2004-10-06 Thread Kalyani Kale
#set ( $displayAddr = $p.getDisplayaddressbool())

if($displayAddr)
//if displayAddr is not null
#else
//control will come here if displayAddr is null #end

If the above code is inside a for loop, the u'll have to set $displayAddr to
false at the end of the loop.

#set ( $displayAddr = false )


Kalyani

-Original Message-
From: Manish [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 06, 2004 12:24 PM
To: Velocity Users List
Subject: Compare null

How can I compare 'null' in my velocity template for if condition???
The following results in an error.

#if(null == $p.getDisplayaddressbool()){
}

TIA,
- Manish


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Compare null

2004-10-06 Thread Manish
Ah thanks!
This should work, but there a global macro somewhere in my code that
replaces all these blank  for nulls by NA value.
Now I'll have to figure out whether this test comes first or it is the
macro. Someone else wrote this code and he's leaving
It's fun being a programmer, excitement never stops! ;)

- Manish

p.s.
Nathan,
Are you one of the original developers of Velocity? I find your replies
quite useful and thorough.


- Original Message -
From: Nathan Bubna [EMAIL PROTECTED]
To: Velocity Users List [EMAIL PROTECTED]
Sent: Wednesday, October 06, 2004 12:43 PM
Subject: Re: Compare null


 Manish said:
  How can I compare 'null' in my velocity template for if condition???
  The following results in an error.
 
  #if(null == $p.getDisplayaddressbool()){
  }

 you're confusing java with VTL.  VTL has no null keyword or token. (though
it
 was discussed favorably in ages long past.)

 i've found the most reliable way to test for nulls is:

 #if( $!myboolean ==  ) foo is null! #end

 Nathan Bubna
 [EMAIL PROTECTED]


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Compare null

2004-10-06 Thread Nathan Bubna
Manish said:
 Ah thanks!
 This should work, but there a global macro somewhere in my code that
 replaces all these blank  for nulls by NA value.
 Now I'll have to figure out whether this test comes first or it is the
 macro. Someone else wrote this code and he's leaving

heh.  yeah, that's always fun.

 It's fun being a programmer, excitement never stops! ;)

 - Manish

 p.s.
 Nathan,
 Are you one of the original developers of Velocity? I find your replies
 quite useful and thorough.

nope.  i'm not even a committer for the velocity core.  i'm just a
velocity-tools committer and long-time velocity user (getting close to 4
years).  so i've been around the lists and the code long enough to pick up a
few useful tricks and tips. :)

Nathan Bubna
[EMAIL PROTECTED]


 - Original Message -
 From: Nathan Bubna [EMAIL PROTECTED]
 To: Velocity Users List [EMAIL PROTECTED]
 Sent: Wednesday, October 06, 2004 12:43 PM
 Subject: Re: Compare null


  Manish said:
   How can I compare 'null' in my velocity template for if condition???
   The following results in an error.
  
   #if(null == $p.getDisplayaddressbool()){
   }
 
  you're confusing java with VTL.  VTL has no null keyword or token. (though
 it
  was discussed favorably in ages long past.)
 
  i've found the most reliable way to test for nulls is:
 
  #if( $!myboolean ==  ) foo is null! #end
 
  Nathan Bubna
  [EMAIL PROTECTED]
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]