"for"-interval issue

Answered

Comments

5 comments

  • Rainer Grabowski (FVM)

    Hi Jan,

    you don't do wrong anything. array[0] works, array[1] works not in the calculation field.
    The last element in your array you get with : betrag.[betrag.length-1]
    By chance, I've investigated on this problem yesterday and I've found some help.
    This works, if the result of your calculation should be a string: String(betrag[1]).

    Rainer

    1
    Comment actions Permalink
  • Jan Richter

    Ah ok. I used that workaround a few times, but always thought I did something wrong. Thank you!

    0
    Comment actions Permalink
  • Jan Richter

    Hej Rainer, the problem got even bigger now. I can't even get the 2nd or 3rd item in an array.

    var betrag = @all of gezahlt (conatins 4 items in array via betrag.length)
    betrag[1], betrag[2] and even betrag[betrag.length-1] don't work any more!

    What is happening?

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Jan, please copy & paste your calculation. Maybe I can see if something is wrong.

    0
    Comment actions Permalink
  • Jan Richter

    No matter, there was no mistakes or errors in the calculation. I found a workaround, that works:

    for(var i =0; i < kategorie.length; i++){
    if(String(kategorie[i]) == search){
    betrag += parseFloat(String(gezahlt[i]));
    }
    }

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk