5 Replies Latest reply on Jan 27, 2015 1:08 AM by schpa

    Performing a bunch of if calculations to find correct value with script

    schpa

      Hey!
        

       

      So I'm currently making a script to get the corresponding suggested price for the amount of kilos in one order, and have therefore set the total kilo of that order in a global variable $$tw and I want to find the correct suggested kiloprice when so and so many kilos are chosen in the actual order.

       

      These are the steps I use to find the right one:

       

      If [$$tw ≤ 10]
          Set Variable $$up; Value:tab_customerprices::_10]
      Else if [10 < $$up ≤ 50]

          Set Variable [$$up; Value:tab_customerprices::_50]
      Else if [50 < $$up ≤ 75]
           Set Variable [$$up; Value:tab_customerprices::_75]
      and so and and so forth

       

      and then setting that value into the orders unitprice field.

       

      However, this for some reason only works to differ between less or equal to 10 and less or equal to 50, when the total kilo exceeds 50, 100, 300 or whatever, it just takes the data from the _50 field and sets that into the unitprice field.

       

      Any ideas?

       

      And yea, I wrote half of the past in cursive, I have no idea how that and I couldn't figure out how to change it back so I just left it like that, hopefulle not too bothersome, hehe, but it has no meaning.

       

      Thanks!

       

      Simen