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

brauche dringend Hilfe bei einem mehrdimensionalem Array

Participant ,
Jul 19, 2017 Jul 19, 2017

Copy link to clipboard

Copied

Liebes Forum,

für einen Kunden erstelle ich beschreibbare und rechenbare PDF-Formulare. Allerdings übersteigt folgende Anforderung mein bescheidenes Wissen.

Ich habe diverse Datensätze (alles Zahlen) aus einer Excel-Tabelle (immer 9 Spalten x 5 Zeilen) und möchte diese als Array in eine Variable schreiben.

Ist das so richtig?

var Tarife = new Array(

[263.7,316.44,382.36,83,99.6,120.35,207.9,731.5,1243],

[241.7,290.04,350.46,83,99.6,120.35,167.2,621.5,1056.08],

[218.6,255.12,316.97,83,99.6,120.35,146.3,475.2,807.48],

[116.3,139.56,168.63,83,99.6,120.35,104.5,0,0],

[105.3,126.36,152.68,83,99.6,120.35,83.6,0,0]

);

Anschließend möchte ich natürlich das Array auslesen und bin maßlos überfordert. Wie spreche ich das Array an, wenn ich beispielsweise Spalte 3/Zeile 5 auslesen möchte?

Vielen Dank für eure Hilfe,

Ralf

Acrobat Pro DC (2017.009.20044) auf macOS Sierra 10.12.5

TOPICS
Acrobat SDK and JavaScript

Views

405

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

Community Expert , Jul 19, 2017 Jul 19, 2017

Yes, it's fine. However, I did make a small mistake above. I didn't use the correct variable name... It should be:

Tarife[4][2]

Which returns "152.68"...

Votes

Translate

Translate
Community Expert ,
Jul 19, 2017 Jul 19, 2017

Copy link to clipboard

Copied

To access an item in an array you need to use the [index] syntax. Just remember that the index number is zero-based.

So to access column 3, line 5 of your array you would use

tariffs[4][2]

The line goes first because the top-most array contains the line, and each line contains the values in columns.

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
Participant ,
Jul 19, 2017 Jul 19, 2017

Copy link to clipboard

Copied

Thanks for your help, try67.

I'll try to work with that. Is the declaration of the Array okay though?

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
Community Expert ,
Jul 19, 2017 Jul 19, 2017

Copy link to clipboard

Copied

Yes, it's fine. However, I did make a small mistake above. I didn't use the correct variable name... It should be:

Tarife[4][2]

Which returns "152.68"...

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
Participant ,
Jul 19, 2017 Jul 19, 2017

Copy link to clipboard

Copied

LATEST

thx try67, you made my day!

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