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 michaelwhat 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 michaelall 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: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>-- Wei He, Ph.D. Email: [EMAIL PROTECTED] Voice: (845)359-5621 Fax: (845)359-1631 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
-- Wei He, Ph.D. Email: [EMAIL PROTECTED] Voice: (845)359-5621 Fax: (845)359-1631 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
