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

What would be the best way to call two arrays (identical structure, just different values)?

Community Beginner ,
Sep 23, 2016 Sep 23, 2016

What would be the best way to incorporate a second array with (identical structure, just different values)?

So by entering a value in a form field, and depending on that value, it would either call the first or second array to use in a calculation.

Would it be best to define multiple arrays in a document level javascript?

TOPICS
Acrobat SDK and JavaScript
272
Translate
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
Community Expert ,
Sep 24, 2016 Sep 24, 2016
LATEST

Your question is not very clear, but sure, you can define as many arrays as you want in the doc-level.

If the arrays have the same structure and length then you can iterate one of them and use the index of the item you're interested in for the other. For example:

var array1 = ["A", "B", "C", "D"];

var array2 = [65, 66, 67, 68];

for (var i=0; i<array1.length; i++) {

     if (array1=="B") app.alert("The number matching B is: " + array2);

}

Translate
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