Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed Help, Grails mongodb if greater than, else if greater than
    primarykey
    data
    text
    <p>I have a little problem and no idea + grey hair.</p> <p>I dont know much about gsp's, groovy, grails etc. But here's the situation:</p> <p>I need to display an image if the number I get from mongodb is greater than 4.5, for example.</p> <p>I tried many different stuff like that: </p> <pre><code> &lt;g:if test="${profil.punkte &gt;0.1}"&gt; &lt;img src="${resource(dir: 'images', file: '1_5.gif')}" alt="gesamtbewertung in sternen" &gt; &lt;/g:if&gt; &lt;g:elseif test="${profil.punkte &gt;1.49}"&gt; &lt;img src="${resource(dir: 'images', file: '2_5.gif')}" alt="gesamtbewertung in sternen" &gt; &lt;/g:elseif&gt; &lt;g:elseif test="${profil.punkte &gt;2.49}"&gt; &lt;img src="${resource(dir: 'images', file: '3_5.gif')}" alt="gesamtbewertung in sternen" &gt; &lt;/g:elseif&gt; &lt;g:elseif test="${profil.punkte &gt;3.49}"&gt; &lt;img src="${resource(dir: 'images', file: '4_5.gif')}" alt="gesamtbewertung in sternen" &gt; &lt;/g:elseif&gt; &lt;g:elseif test="${profil.punkte &gt;4.49}"&gt; &lt;img src="${resource(dir: 'images', file: '5_5.gif')}" alt="gesamtbewertung in sternen" &gt; &lt;/g:elseif&gt; </code></pre> <p>I tried a lot of different syntaxes to solve this, but it just won´t work. In the version above it always shows 1_5.gif</p> <p>The entry in the "profil.groovy" looks sth. Like:</p> <pre><code>class Profil { ObjectId id ... ... double punkte } </code></pre> <p>And the entry in mongodb´s JSON looks like :</p> <pre><code> "punkte": 4.3, </code></pre> <p>I just need to type ${profil.punkte} and I get 4.3 rendered.</p> <p>Hope you understand my problem even if my english is broken. I will make a backflip on my laptop for solving!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload