title: if then else velocity
body: <p>During my searching, I would like your help on this problem :</p>
  
  <p>I have this code </p>
  
  <pre><code>#set($infos=$tracker.getTrackingInfos("$query.reference.toUpperCase()"))
  
              infos : $infos
  
              #if($infos)
  
                  #set($e = $tracker.getEnvoi($query.reference.toUpperCase().trim()))
                  #set($destinataire = $e.destinataire) 
                  #set($expediteur = $e.expediteur)   
  
                  #set($dbBoxtale.ope = $e.envoi_reference.substring(0,4))
                  #set($operateur = $dbBoxtale.operateur_by_code)         
  
                  &lt;!---------- INFORMATIONS ----------&gt;
                  #set($infos=$tracker.getTrackingInfos("${e.envoi_numfact}${e.envoi_reference}"))
                  #set($reference = $!e.envoi_opeinfos)
                  #parse("/inc/tracking_display.inc")
  
                  &lt;!---------- ORDER RECAP ----------&gt;
                      &lt;div class="row "&gt;
                          &lt;h2 class="mt20"&gt;Récapitulatif de votre commande : $query.reference&lt;/h2&gt;
                          &lt;div class="bg-top-box pl20 mb20 row p15"&gt;
                              &lt;p class="title-border s14 light pt10"&gt;&lt;img class="mb5 mr5" src="$resourcesData.img.ico-box2" alt="" /&gt;Contenu de votre envoi&lt;/p&gt;
                              &lt;p class="pt10 pl15"&gt;
  
                                  #foreach($grp in $e.groupe_objets)
                                      #set($display = $e.envoi_type.toLowerCase())
  
                                      #if($e.type_envoi == "Objet lourd") 
                                          #set($display = "encombrant")
                                      #end
  
                                      &lt;strong&gt;$grp.nb 
                                          #if($e.groupe_objet == 1 || $e.envoi_type == "Colis") 
                                              $display
                                          #else 
                                              ${display}s
                                          #end
                                      &lt;/strong&gt; - $grp.poids kg - &lt;strong&gt;Dimensions&lt;/strong&gt; $grp.longueur cm x $grp.largeur cm #if($e.envoi_type != "Pli") x $grp.hauteur cm #end &lt;br /&gt;
                                      &lt;strong&gt;Contenu :&lt;/strong&gt; $e.envoi_typeobjet
  
                                  #end
  
                              &lt;p class="text-warning pl15 pb10 pt10"&gt;
                                  &lt;img alt="" src="$resourcesData.img.ico-alert-small"&gt;
                                  Si les dimensions et poids sont erronés, votre envoi sera bloqué par le transporteur.
                              &lt;/p&gt;
  
                          &lt;/div&gt;&lt;!--end bg-top-box pt15 pl20 mb20 row p15 --&gt;
  
                      &lt;/div&gt;
  
              #elseif(!$infos)
  
                  &lt;img class="" src="$resourcesData.img.ico-warning"  alt=""&gt; 
  
  
              #end
  
          #end
  </code></pre>
  
  <p>In fact, I am trying to type a reference and if the reference exists in the DB, the area "#if" is executed and if the reference doesn't exist in DB the "#elseif" is executed.</p>
  
  <p>But now when I type a wrong reference It doesn't enter in the #elseif, I don't know why.</p>
  
  <p>If you have idea...</p>
  
  <p>Ale</p>