1 Reply Latest reply on Aug 30, 2017 8:33 AM by gkaiseril

    Help with grabbing a number from 1 place and adding it to another with a number behind it.


      So, i got a button which grabs a employee number from a field and adding it to another field. I want my from to add a number behind the number it just grabbed, but so far i can only get it to add the number to current number instead of putting it behind it. Everything else i've done is wrking (Got an alert if the field the button grabs data from is empty and got it to grab the number and paste it in the field) but from here im lost. Everything i've tried just aint working. This is my current code.


      var f = this.getField("Medarbejder nr").valueAsString;

      var v = this.getField("Løbenummer").valueAsString;

      var msg = "Udfyld medarbejder nummer først";



      if (this.getField("Medarbejder nr").valueAsString=="") {



      this.getField("Løbenummer").valueAsString=="" && app.alert(msg,1)}



      else {

          this.getField("Løbenummer").value = util.printf(this.getField("Medarbejder nr").value +1);




      I understand the +1 in the last line is what is wrong, but i dont know what to replace it with.



      Edit: My boss just informed me that he only want the last 3 digits of the field "Medarbejder nr" then add 3 numbers behind it starting with 001. Help with this aswell would be greatly appriciated.


      Edit2: Got the number splitted so i only get the last 3 digits of "medarbejder nr", still need help with adding the 3 digits after it starting with 001.