• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

is there a way to add(+) two loadedData

New Here ,
Nov 11, 2017 Nov 11, 2017

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]

Views

242

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 11, 2017 Nov 11, 2017

You can use Number():

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

Votes

Translate

Translate
LEGEND ,
Nov 11, 2017 Nov 11, 2017

Copy link to clipboard

Copied

You can use Number():

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 11, 2017 Nov 11, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 11, 2017 Nov 11, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 12, 2017 Nov 12, 2017

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines