You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Wei He <we...@ldeo.columbia.edu> on 2002/12/16 03:20:09 UTC

Re: Velocity Expression

all of your A, B, and C are in fact Integer, the java Object, so
try

#if ($entry.A.intValue() == 3)
....
#end

Eigen Technology Pty Ltd wrote:
> Dear all,
> 
> I have the following expression in one of my Velocity file:
> 
>         #foreach ($entry in $entries)
>         <tr>
>         #if($entry.A == 3)
>           #entryCell ($entry.Id)
>           #entryCell ($entry.A)
>           #entryCell ($entry.B)
>           #entryCell ($entry.C)
>         </tr>
>        #end
>        #end
> 
> the comparison expression only works for $entry.B, neither $entry.A nor
> $entry.C work, i.e. A and C return no result. All A, B and C are int. I
> have tried to compare as number (3) and text ("3"), only getting the same
> result.  What is limiting the expression? Would appreciate some hints.
> 
> best wishes
> michael
> 
> 
> 
> 
> --
> 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: Velocity Expression

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
I am really baffled by this Velocity behaviour ...

The returned valued from the BaseXXX.java file for value A, B and C are
all int. However, only only condition for test B works, I tried:

#if ($entry.A < 0)

and

#if ($entry.A > 0)

both failed. This indicates that $entry.A is probably not even an integer
or numerical value. What is the type for return value like this? And why
does B work and not A ??

getting really confused here.

thanks for any help
michael





>
> all of your A, B, and C are in fact Integer, the java Object, so
> try
>
> #if ($entry.A.intValue() == 3)
> ....
> #end
>
> Eigen Technology Pty Ltd wrote:
>> Dear all,
>>
>> I have the following expression in one of my Velocity file:
>>
>>         #foreach ($entry in $entries)
>>         <tr>
>>         #if($entry.A == 3)
>>           #entryCell ($entry.Id)
>>           #entryCell ($entry.A)
>>           #entryCell ($entry.B)
>>           #entryCell ($entry.C)
>>         </tr>
>>        #end
>>        #end
>>
>> the comparison expression only works for $entry.B, neither $entry.A
>> nor $entry.C work, i.e. A and C return no result. All A, B and C are
>> int. I have tried to compare as number (3) and text ("3"), only
>> getting the same result.  What is limiting the expression? Would
>> appreciate some hints.
>>
>> best wishes
>> michael
>>
>>
>>
>>
>> --
>> 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>




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


Re: Velocity Expression

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"Eigen Technology Pty Ltd" <mi...@eigentechnology.com> writes:

>Alright guys, I may not sound very intelligent on this matter, but I am
>really frustrated with the outcome given by Velocity.  I changed A and C
>to VARCHAR and it worked!!

Yep. That's an ongoing source of frustration for Velocity newcomers and
seasoned users. Geir wants it that way and there is no way around it.

You might even check if it really checks the value against 3 (value
three) or "3" (string containing '3' char).

>But I am not really satisfied with this outcome, there must be a logical
>explanation to this, why INT works for some but not others?

Uh, there is a _longish_ thread about this in the velocity-dev
archives. I even had some patches for Velocity 1.1 at some point to
fix this behaviour which Geir didn't want.

Conclusion was "Velocity is a templating language, not a programming
language. If you do business logic in it, you're doing something
wrong". No, that's not _my_ opinion.

	Regards
		Henning
-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20   

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


Re: Velocity Expression

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Alright guys, I may not sound very intelligent on this matter, but I am
really frustrated with the outcome given by Velocity.  I changed A and C
to VARCHAR and it worked!!

But I am not really satisfied with this outcome, there must be a logical
explanation to this, why INT works for some but not others?

I am not unfamilia with programming, would really appreciate if anyone can
point out where I have done wrong.

best wishes
michael








> Thanks Wei,
>
> I have corrected the </tr> part, it gives the same result.
> Here is my schema file, I have modified it to A, B and C for the sake of
> simplicity, it is actually:
>
> <table name="INVOICEITEM">
>     <column name="ID" required="true" autoIncrement="true"
> primaryKey="true" type="INTEGER"/>
>     <column name="INVOICEREF" size="10" type="INTEGER"/>
>     <column name="CUSTOMERREF" size="10" type="INTEGER"/>
>     <column name="QUANTITY" size="10" type="INTEGER"/>
>     <column name="PARTICULAR" size="50" type="VARCHAR"/>
>     <column name="UNITPRICE" type="FLOAT"/>
>     <column name="TAX" type="FLOAT"/>
>     <column name="AMOUNT" type="FLOAT"/>
>     <column name="COMMENT" type="LONGVARCHAR"/>
>     <foreign-key foreignTable="CUSTOMER">
>     <reference local="QUANTIT2" foreign="ID"/>
>     </foreign-key>
>     <foreign-key foreignTable="INVOICE">
>     <reference local="INVOICEREF" foreign="ID"/>
>     </foreign-key>
>     </table>
>
> only Quantity worked, invoiceref, id, customerref, amount etc all failed
> the expression test.
>
> thanks
> michael
>
>
>
>
>>
>> what is your schema look like? also, i noticed that you <tr> should be
>> outside of inner #if #end block. this may cause problem in you
>> displayed result as well.  do a view source in you browser to see if
>> the syntax is
>>  correct.
>>
>>  >>>       #foreach ($entry in $entries)
>>  >>>        <tr>
>>  >>>        #if($entry.A == 3)
>>  >>>          #entryCell ($entry.Id)
>>  >>>          #entryCell ($entry.A)
>>  >>>          #entryCell ($entry.B)
>>  >>>          #entryCell ($entry.C)
>>  >>>        </tr>
>>  >>>       #end
>>  >>>       #end
>>  >>>
>>
>> Eigen Technology Pty Ltd wrote:
>>> Thanks,
>>>
>>> I tried your method, but I got the same result, i.e B is working, A
>>> and C do not work.  I tried to swap A and B in the database, again,
>>> only the new B worked, A still does not work.  Help would
>>> appreciated.
>>>
>>> best wishes
>>> michael
>>>
>>>
>>>
>>>
>>>
>>>>all of your A, B, and C are in fact Integer, the java Object, so try
>>>>
>>>>#if ($entry.A.intValue() == 3)
>>>>....
>>>>#end
>>>>
>>>>Eigen Technology Pty Ltd wrote:
>>>>
>>>>>Dear all,
>>>>>
>>>>>I have the following expression in one of my Velocity file:
>>>>>
>>>>>        #foreach ($entry in $entries)
>>>>>        <tr>
>>>>>        #if($entry.A == 3)
>>>>>          #entryCell ($entry.Id)
>>>>>          #entryCell ($entry.A)
>>>>>          #entryCell ($entry.B)
>>>>>          #entryCell ($entry.C)
>>>>>        </tr>
>>>>>       #end
>>>>>       #end
>>>>>
>>>>>the comparison expression only works for $entry.B, neither $entry.A
>>>>> nor $entry.C work, i.e. A and C return no result. All A, B and C
>>>>> are int. I have tried to compare as number (3) and text ("3"), only
>>>>> getting the same result.  What is limiting the expression? Would
>>>>> appreciate some hints.
>>>>>
>>>>>best wishes
>>>>>michael
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>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>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org> For additional
>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>
>>
>> --
>> Wei He, Ph.D.
>> Email: weihe@optonline.net
>> Voice: (845)359-5621
>> Fax:   (845)359-1631
>>
>>
>> --
>> 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>




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


Re: Velocity Expression

Posted by Rodney Schneider <ro...@actf.com.au>.
On Mon, 16 Dec 2002 16:26, you wrote:
> Thanks, that worked.
>
> These are crucial information that a website developer should know. I
> may have missed it in the documentations, if that is the case, please
> tell me where I can find info like that, so that I won't have to
> bother others.

Here is an exceprt from the TDK Howto:
"The java classes that Turbine uses to access your database are located
 in the directory "webapps/APPNAME/WEB-INF/src/java/PACKAGE/om" Look at 
 them to get an idea of how the object-model portion of Turbine
 operates. There should be one named after each of the tables that you
 defined above in your schema. These classes will be used to interact
 with the database while using Turbine."

Also see the Velocity User Guide:
http://jakarta.apache.org/velocity/user-guide.html

If you think the documentation should be clearer, you can always submit 
a patch :)

Regards,

-- Rodney

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


Re: Velocity Expression

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Thanks, that worked.

These are crucial information that a website developer should know. I may
have missed it in the documentations, if that is the case, please tell me
where I can find info like that, so that I won't have to bother others.

best wishes
michael



>
> OK, the ref columns are foreign-key columns, they are returned as
> NumberKey object, all numeric primar keys in your tables are directly
> returned as NumberKey as well.
>
> Here is what you can do:
>
> $entry.A.getBigDecimal().intValue()
>
> this should fix the problem, this is exactly what I was suspecting.  I
> do not know if int actually gets returned for other cases as well,
> velocity handles Object only, not primitives, I think.
>
>
> Eigen Technology Pty Ltd wrote:
>> Thanks Wei,
>>
>> I have corrected the </tr> part, it gives the same result.
>> Here is my schema file, I have modified it to A, B and C for the sake
>> of simplicity, it is actually:
>>
>> <table name="INVOICEITEM">
>>     <column name="ID" required="true" autoIncrement="true"
>> primaryKey="true" type="INTEGER"/>
>>     <column name="INVOICEREF" size="10" type="INTEGER"/>
>>     <column name="CUSTOMERREF" size="10" type="INTEGER"/>
>>     <column name="QUANTITY" size="10" type="INTEGER"/>
>>     <column name="PARTICULAR" size="50" type="VARCHAR"/>
>>     <column name="UNITPRICE" type="FLOAT"/>
>>     <column name="TAX" type="FLOAT"/>
>>     <column name="AMOUNT" type="FLOAT"/>
>>     <column name="COMMENT" type="LONGVARCHAR"/>
>>     <foreign-key foreignTable="CUSTOMER">
>>     <reference local="QUANTIT2" foreign="ID"/>
>>     </foreign-key>
>>     <foreign-key foreignTable="INVOICE">
>>     <reference local="INVOICEREF" foreign="ID"/>
>>     </foreign-key>
>>     </table>
>>
>> only Quantity worked, invoiceref, id, customerref, amount etc all
>> failed the expression test.
>>
>> thanks
>> michael
>>
>>
>>
>>
>>
>>>what is your schema look like? also, i noticed that you <tr> should be
>>> outside of inner #if #end block. this may cause problem in you
>>> displayed result as well.  do a view source in you browser to see if
>>> the syntax is
>>> correct.
>>>
>>> >>>       #foreach ($entry in $entries)
>>> >>>        <tr>
>>> >>>        #if($entry.A == 3)
>>> >>>          #entryCell ($entry.Id)
>>> >>>          #entryCell ($entry.A)
>>> >>>          #entryCell ($entry.B)
>>> >>>          #entryCell ($entry.C)
>>> >>>        </tr>
>>> >>>       #end
>>> >>>       #end
>>> >>>
>>>
>>>Eigen Technology Pty Ltd wrote:
>>>
>>>>Thanks,
>>>>
>>>>I tried your method, but I got the same result, i.e B is working, A
>>>> and C do not work.  I tried to swap A and B in the database, again,
>>>> only the new B worked, A still does not work.  Help would
>>>> appreciated.
>>>>
>>>>best wishes
>>>>michael
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>all of your A, B, and C are in fact Integer, the java Object, so try
>>>>>
>>>>>#if ($entry.A.intValue() == 3)
>>>>>....
>>>>>#end
>>>>>
>>>>>Eigen Technology Pty Ltd wrote:
>>>>>
>>>>>
>>>>>>Dear all,
>>>>>>
>>>>>>I have the following expression in one of my Velocity file:
>>>>>>
>>>>>>       #foreach ($entry in $entries)
>>>>>>       <tr>
>>>>>>       #if($entry.A == 3)
>>>>>>         #entryCell ($entry.Id)
>>>>>>         #entryCell ($entry.A)
>>>>>>         #entryCell ($entry.B)
>>>>>>         #entryCell ($entry.C)
>>>>>>       </tr>
>>>>>>      #end
>>>>>>      #end
>>>>>>
>>>>>>the comparison expression only works for $entry.B, neither $entry.A
>>>>>> nor $entry.C work, i.e. A and C return no result. All A, B and C
>>>>>> are int. I have tried to compare as number (3) and text ("3"), only
>>>>>> getting the same result.  What is limiting the expression? Would
>>>>>> appreciate some hints.
>>>>>>
>>>>>>best wishes
>>>>>>michael
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>--
>>>>>>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>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:
>>>><ma...@jakarta.apache.org> For additional
>>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>>
>>>
>>>--
>>>Wei He, Ph.D.
>>>Email: weihe@optonline.net
>>>Voice: (845)359-5621
>>>Fax:   (845)359-1631
>>>
>>>
>>>--
>>>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>
>>
>
>
> --
> Wei He, Ph.D.
> Email: weihe@optonline.net
> Voice: (845)359-5621
> Fax:   (845)359-1631
>
>
> --
> 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: Velocity Expression

Posted by Wei He <we...@ldeo.columbia.edu>.
OK, the ref columns are foreign-key columns, they are returned as 
NumberKey object, all numeric primar keys in your tables are directly 
returned as NumberKey as well.

Here is what you can do:

$entry.A.getBigDecimal().intValue()

this should fix the problem, this is exactly what I was suspecting.  I 
do not know if int actually gets returned for other cases as well, 
velocity handles Object only, not primitives, I think.


Eigen Technology Pty Ltd wrote:
> Thanks Wei,
> 
> I have corrected the </tr> part, it gives the same result.
> Here is my schema file, I have modified it to A, B and C for the sake of
> simplicity, it is actually:
> 
> <table name="INVOICEITEM">
>     <column name="ID" required="true" autoIncrement="true"
> primaryKey="true" type="INTEGER"/>
>     <column name="INVOICEREF" size="10" type="INTEGER"/>
>     <column name="CUSTOMERREF" size="10" type="INTEGER"/>
>     <column name="QUANTITY" size="10" type="INTEGER"/>
>     <column name="PARTICULAR" size="50" type="VARCHAR"/>
>     <column name="UNITPRICE" type="FLOAT"/>
>     <column name="TAX" type="FLOAT"/>
>     <column name="AMOUNT" type="FLOAT"/>
>     <column name="COMMENT" type="LONGVARCHAR"/>
>     <foreign-key foreignTable="CUSTOMER">
>     <reference local="QUANTIT2" foreign="ID"/>
>     </foreign-key>
>     <foreign-key foreignTable="INVOICE">
>     <reference local="INVOICEREF" foreign="ID"/>
>     </foreign-key>
>     </table>
> 
> only Quantity worked, invoiceref, id, customerref, amount etc all failed
> the expression test.
> 
> thanks
> michael
> 
> 
> 
> 
> 
>>what is your schema look like? also, i noticed that you <tr> should be
>>outside of inner #if #end block. this may cause problem in you displayed
>>result as well.  do a view source in you browser to see if the syntax is
>> correct.
>>
>> >>>       #foreach ($entry in $entries)
>> >>>        <tr>
>> >>>        #if($entry.A == 3)
>> >>>          #entryCell ($entry.Id)
>> >>>          #entryCell ($entry.A)
>> >>>          #entryCell ($entry.B)
>> >>>          #entryCell ($entry.C)
>> >>>        </tr>
>> >>>       #end
>> >>>       #end
>> >>>
>>
>>Eigen Technology Pty Ltd wrote:
>>
>>>Thanks,
>>>
>>>I tried your method, but I got the same result, i.e B is working, A
>>>and C do not work.  I tried to swap A and B in the database, again,
>>>only the new B worked, A still does not work.  Help would appreciated.
>>>
>>>best wishes
>>>michael
>>>
>>>
>>>
>>>
>>>
>>>
>>>>all of your A, B, and C are in fact Integer, the java Object, so try
>>>>
>>>>#if ($entry.A.intValue() == 3)
>>>>....
>>>>#end
>>>>
>>>>Eigen Technology Pty Ltd wrote:
>>>>
>>>>
>>>>>Dear all,
>>>>>
>>>>>I have the following expression in one of my Velocity file:
>>>>>
>>>>>       #foreach ($entry in $entries)
>>>>>       <tr>
>>>>>       #if($entry.A == 3)
>>>>>         #entryCell ($entry.Id)
>>>>>         #entryCell ($entry.A)
>>>>>         #entryCell ($entry.B)
>>>>>         #entryCell ($entry.C)
>>>>>       </tr>
>>>>>      #end
>>>>>      #end
>>>>>
>>>>>the comparison expression only works for $entry.B, neither $entry.A
>>>>>nor $entry.C work, i.e. A and C return no result. All A, B and C are
>>>>>int. I have tried to compare as number (3) and text ("3"), only
>>>>>getting the same result.  What is limiting the expression? Would
>>>>>appreciate some hints.
>>>>>
>>>>>best wishes
>>>>>michael
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>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>
>>>
>>>
>>>
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><ma...@jakarta.apache.org> For additional
>>>commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>
>>--
>>Wei He, Ph.D.
>>Email: weihe@optonline.net
>>Voice: (845)359-5621
>>Fax:   (845)359-1631
>>
>>
>>--
>>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>
> 


-- 
Wei He, Ph.D.
Email: weihe@optonline.net
Voice: (845)359-5621
Fax:   (845)359-1631


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


Re: Velocity Expression

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Thanks Wei,

I have corrected the </tr> part, it gives the same result.
Here is my schema file, I have modified it to A, B and C for the sake of
simplicity, it is actually:

<table name="INVOICEITEM">
    <column name="ID" required="true" autoIncrement="true"
primaryKey="true" type="INTEGER"/>
    <column name="INVOICEREF" size="10" type="INTEGER"/>
    <column name="CUSTOMERREF" size="10" type="INTEGER"/>
    <column name="QUANTITY" size="10" type="INTEGER"/>
    <column name="PARTICULAR" size="50" type="VARCHAR"/>
    <column name="UNITPRICE" type="FLOAT"/>
    <column name="TAX" type="FLOAT"/>
    <column name="AMOUNT" type="FLOAT"/>
    <column name="COMMENT" type="LONGVARCHAR"/>
    <foreign-key foreignTable="CUSTOMER">
    <reference local="QUANTIT2" foreign="ID"/>
    </foreign-key>
    <foreign-key foreignTable="INVOICE">
    <reference local="INVOICEREF" foreign="ID"/>
    </foreign-key>
    </table>

only Quantity worked, invoiceref, id, customerref, amount etc all failed
the expression test.

thanks
michael




>
> what is your schema look like? also, i noticed that you <tr> should be
> outside of inner #if #end block. this may cause problem in you displayed
> result as well.  do a view source in you browser to see if the syntax is
>  correct.
>
>  >>>       #foreach ($entry in $entries)
>  >>>        <tr>
>  >>>        #if($entry.A == 3)
>  >>>          #entryCell ($entry.Id)
>  >>>          #entryCell ($entry.A)
>  >>>          #entryCell ($entry.B)
>  >>>          #entryCell ($entry.C)
>  >>>        </tr>
>  >>>       #end
>  >>>       #end
>  >>>
>
> Eigen Technology Pty Ltd wrote:
>> Thanks,
>>
>> I tried your method, but I got the same result, i.e B is working, A
>> and C do not work.  I tried to swap A and B in the database, again,
>> only the new B worked, A still does not work.  Help would appreciated.
>>
>> best wishes
>> michael
>>
>>
>>
>>
>>
>>>all of your A, B, and C are in fact Integer, the java Object, so try
>>>
>>>#if ($entry.A.intValue() == 3)
>>>....
>>>#end
>>>
>>>Eigen Technology Pty Ltd wrote:
>>>
>>>>Dear all,
>>>>
>>>>I have the following expression in one of my Velocity file:
>>>>
>>>>        #foreach ($entry in $entries)
>>>>        <tr>
>>>>        #if($entry.A == 3)
>>>>          #entryCell ($entry.Id)
>>>>          #entryCell ($entry.A)
>>>>          #entryCell ($entry.B)
>>>>          #entryCell ($entry.C)
>>>>        </tr>
>>>>       #end
>>>>       #end
>>>>
>>>>the comparison expression only works for $entry.B, neither $entry.A
>>>> nor $entry.C work, i.e. A and C return no result. All A, B and C are
>>>> int. I have tried to compare as number (3) and text ("3"), only
>>>> getting the same result.  What is limiting the expression? Would
>>>> appreciate some hints.
>>>>
>>>>best wishes
>>>>michael
>>>>
>>>>
>>>>
>>>>
>>>>--
>>>>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>
>>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>
>
> --
> Wei He, Ph.D.
> Email: weihe@optonline.net
> Voice: (845)359-5621
> Fax:   (845)359-1631
>
>
> --
> 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: Velocity Expression

Posted by Wei He <we...@ldeo.columbia.edu>.
what is your schema look like? also, i noticed that you <tr> should be 
outside of inner #if #end block. this may cause problem in you displayed
result as well.  do a view source in you browser to see if the syntax is 
correct.

 >>>       #foreach ($entry in $entries)
 >>>        <tr>
 >>>        #if($entry.A == 3)
 >>>          #entryCell ($entry.Id)
 >>>          #entryCell ($entry.A)
 >>>          #entryCell ($entry.B)
 >>>          #entryCell ($entry.C)
 >>>        </tr>
 >>>       #end
 >>>       #end
 >>>

Eigen Technology Pty Ltd wrote:
> Thanks,
> 
> I tried your method, but I got the same result, i.e B is working, A and C
> do not work.  I tried to swap A and B in the database, again, only the new
> B worked, A still does not work.  Help would appreciated.
> 
> best wishes
> michael
> 
> 
> 
> 
> 
>>all of your A, B, and C are in fact Integer, the java Object, so
>>try
>>
>>#if ($entry.A.intValue() == 3)
>>....
>>#end
>>
>>Eigen Technology Pty Ltd wrote:
>>
>>>Dear all,
>>>
>>>I have the following expression in one of my Velocity file:
>>>
>>>        #foreach ($entry in $entries)
>>>        <tr>
>>>        #if($entry.A == 3)
>>>          #entryCell ($entry.Id)
>>>          #entryCell ($entry.A)
>>>          #entryCell ($entry.B)
>>>          #entryCell ($entry.C)
>>>        </tr>
>>>       #end
>>>       #end
>>>
>>>the comparison expression only works for $entry.B, neither $entry.A
>>>nor $entry.C work, i.e. A and C return no result. All A, B and C are
>>>int. I have tried to compare as number (3) and text ("3"), only
>>>getting the same result.  What is limiting the expression? Would
>>>appreciate some hints.
>>>
>>>best wishes
>>>michael
>>>
>>>
>>>
>>>
>>>--
>>>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>
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


-- 
Wei He, Ph.D.
Email: weihe@optonline.net
Voice: (845)359-5621
Fax:   (845)359-1631


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


Re: Velocity Expression

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Thanks,

I tried your method, but I got the same result, i.e B is working, A and C
do not work.  I tried to swap A and B in the database, again, only the new
B worked, A still does not work.  Help would appreciated.

best wishes
michael




> all of your A, B, and C are in fact Integer, the java Object, so
> try
>
> #if ($entry.A.intValue() == 3)
> ....
> #end
>
> Eigen Technology Pty Ltd wrote:
>> Dear all,
>>
>> I have the following expression in one of my Velocity file:
>>
>>         #foreach ($entry in $entries)
>>         <tr>
>>         #if($entry.A == 3)
>>           #entryCell ($entry.Id)
>>           #entryCell ($entry.A)
>>           #entryCell ($entry.B)
>>           #entryCell ($entry.C)
>>         </tr>
>>        #end
>>        #end
>>
>> the comparison expression only works for $entry.B, neither $entry.A
>> nor $entry.C work, i.e. A and C return no result. All A, B and C are
>> int. I have tried to compare as number (3) and text ("3"), only
>> getting the same result.  What is limiting the expression? Would
>> appreciate some hints.
>>
>> best wishes
>> michael
>>
>>
>>
>>
>> --
>> 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>




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