Are your values stored as Integer, Long or primitive ints/longs in your bean?
If they are primitives then doing something like #if ($myBean.somePrimitiveValue == 3) probably wont work since I think that the underlying velocity code will try and do some sort of primitive / Object (since 3 is converted to an Integer) comparison. Then again, I may be totally wrong here. -----Original Message----- From: Eigen Technology Pty Ltd [mailto:[EMAIL PROTECTED]] Sent: Monday, 16 December 2002 3:49 PM To: [EMAIL PROTECTED] Subject: Re: Velocity Expression 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: >>>>><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]> -- 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]>
