velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Catlin <gcatli...@gmail.com>
Subject Simple comparison not working
Date Thu, 04 Nov 2010 12:57:16 GMT
Hello All,

Does anyone know why the code below is not working as intended? I am
attempting to group the records in $Array by the value of $Array.Rank. I
have examined the contents and $Array.Rank returns values between 1 and 70,
as expected. The conditions in my 3 #if statements don't seem to be getting
activated, and $MS1/2/3 are empty.

Thank you.

#set ($MS1 = [])
#set ($MS2 = [])
#set ($MS3 = [])
#set ($mrank = 0)

#foreach ($element in $SortTool.sort($Array, ["rank", "name"]))
    #set ($mrank = $element.Rank)
    #set ($record = { 'Rank' : $element.Rank, 'Title' : $element.Name } )
    #if ($mrank <= 30) #set ($n = $MS1.add($record)) #end
    #if ($mrank >= 60) #set ($n = $MS3.add($record)) #end
    #if ($mrank > 30 && $mrank < 60) #set ($n = $MS2.add($record)) #end
##    #set ($n = $MS1.add($record))    ## debug, commented out
#end

Gary Catlin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message