<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi Enrico,</p>
<p>I can't tell why this expression fails, but there is a more elegant way to distinguish between even and odd numbers. The modulus operator (%).</p>
<p>CASE WHEN <span>@atlas_featurenumber % 2 = 0 THEN --these are the even pages<br />   210 - @value<br /> ELSE --these are the odd pages<br />  @value<br />END</span></p>
<p><span>The modulus operator returns the remainder after the divison - e.g. 5 % 2 returns 1, 6 % 2 returns 0, 7 % 2 returns 1, 8 % 2 returns 0 and so on.</span></p>
<p><span>Als note, that @atlas_featureid is not a good variable to use, because it isn't always guaranteed that the is no hole in your primary key sequence (e.g. if you delete features) - you would also run into troubles if you start filtering features in the atlas. I would rather suggest to use the variable @atlas_featurenumber. This should always start at 1 and increment by one for each subsequent atlas record, regardless of any filter or holes in the primary key sequence.</span></p>
<p>Hope this helps,</p>
<p>Andreas</p>
<p>On 2016-04-06 10:29, Enrico Ferreguti wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div dir="ltr">
<div>
<div>Is there a way to get the current item value that is being modified by expressions.</div>
I would like to reformat my print composer atlas for two sided printing referencing to @value variable without success:<br /><br />CASE <br />WHEN  floor(  @atlas_featureid/2 )*2 =  @atlas_featureid  THEN 210 - @value<br />ELSE  @value<br />END<br /><br /></div>
but I get always @value....<br />
<div> </div>
</div>
<br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">_______________________________________________<br /> Qgis-user mailing list<br /><a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br /> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br /> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a></div>
</blockquote>
<p> </p>
<div> </div>
</body></html>