Skip to main content
Participant
November 11, 2017
Answered

is there a way to add(+) two loadedData

  • November 11, 2017
  • 1 reply
  • 399 views

Hi everybody

As you will understand I am rookie in this.

I am loading some data from a csv file. now I made some dynamic fields and one of should be the value loadedData[1][0]  + the value of loadedData[1][1],

lets suppose that  the value loadedData[1][0]  is "3" and the value loadedData[1][1] is "2" , I do not get "5" but 32 insted. All other / * - work fine but nor the plus sign.

I already tried adding brackets but nothing. By the way I use animate cc .

example:  stats.st4.text = loadedData[1][0] + loadedData[1][1];

Thanks in Advance

Ioannis

[Moved from the non-technical Lounge to the specific Program forum... Mod]

[Here is the list of all Adobe forums... https://forums.adobe.com/welcome]

This topic has been closed for replies.
Correct answer Colin Holgate

You can use Number():

example:  stats.st4.text = Number(loadedData[1][0]) + Number(loadedData[1][1]);

1 reply

Colin Holgate
Colin HolgateCorrect answer
Inspiring
November 11, 2017

You can use Number():

example:  stats.st4.text = Number(loadedData[1][0]) + Number(loadedData[1][1]);

Participant
November 11, 2017

Hi Colin

thanks for the answer that worked as expected. This solved my problem, but now another come up. I could save all of us some time if I posted the whole line from start.

As you can see bellow there were more before and after the addition, so when I test your code alone it works fine, but when I add the rest, again I get "32" and not "5". Keep in mind that I only need to "add" the loadedData[1][0] + loadedData[1][1] , the rest of the plus(+) signs are just to include the rest of the loadedData in my text field.

stats.st1.text =loadedData[1][12] + "/" +  Number(loadedData[1][0]) + Number(loadedData[1][1])  + " " +  loadedData[1][14];

An suggestions?

Thanks again for the answer

Participant
November 11, 2017

Just to save you some time, I added some more brackets before and after your code and it worked, I need to thank you again, if it wasn't your answer I would be still stack,

Thanks Again

Ioannis