xsanisty / calx.js

jQuery Calx - a jQuery plugin for creating formula-based calculation form
http://www.xsanisty.com/project/calx2
MIT License
198 stars 72 forks source link

IF returns True and False #29

Open Hatalias opened 8 years ago

Hatalias commented 8 years ago

I'm riding a code where I need the IF returns a value instead of true and false data-formula="IF(A1>A2, 15, 20" Not = True and False

ikhsan017 commented 7 years ago

Yes, that is how IF formula supposed to works, it will return the value instead of just true or false

can you provide sample where it doesn't work?

danperrout commented 7 years ago
        <form id="simula">
             <label>Cotação Base</label> <input class="money" type="text" id="C2" data-cell="C2"/><br>
             <label>Strike</label> <input class="money" type="text" id="B5" data-cell="B5"/><br>
             <label>Prêmio</label> <input class="money" type="text" id="C5" data-cell="C5" /><br>
             <label>P.M.</label> <input class="money" type="text" id="Q1" data-cell="Q1" data-format="0" /><br>
             <label>Breakeven</label> <input type="text" id="N5" data-cell="N5"  data-formula="Q1-C5" /><br>
             <label>Qtde.</label> <input type="text" id="Q2" data-cell="Q2"  data-formula="" /><br>
             <label>L/P</label> <input  id="Q5" data-cell="Q5"  data-format="0" data-formula="IF($B5 > $C2, $C5, $C2)" /><br>
             <label data-cell="K1" data-formula="IF($B5 > $C2, $C5, $C2)" data-format="0.00"></label>
             <label>Tot</label> <input  id="E1" data-cell="E1" data-format="0[.]00 %" data-formula="($B1*$C1)*(1-$D1)" /><br>
         </form>

My code only returns "true" or "false", not the value itself.

Can you help me?

Hatalias commented 7 years ago

Hi, Try to use version 2.2.5 or earlier, version 2.2.7 returns the value "true" or "false". I hope I helped you