Copy link to clipboard
Copied
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]
You can use Number():
example: stats.st4.text = Number(loadedData[1][0]) + Number(loadedData[1][1]);
Copy link to clipboard
Copied
You can use Number():
example: stats.st4.text = Number(loadedData[1][0]) + Number(loadedData[1][1]);
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
These are brackets: [ ]
These are parentheses: ( )
It would be ideal if your data loader converted the appropriate fields to the correct data types, instead of leaving the code that uses the data to fend for itself.
I do hope you understand why your issue was occurring, and why using Number() fixed it.