• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

does extendscript manage multidimessionnal array ?

Community Beginner ,
Feb 08, 2018 Feb 08, 2018

Copy link to clipboard

Copied

hello forum.

i don't undestand why ES does not restitute correctly the data i input in the array.

i use the code of the export of "ExtendScript of the Week: Import and Export Variables "

i need to change the output . I want on one line all the variables for a same file .

so i add this  function to move from vertical to horizontal display. i send after  to a function that log in a file

function TransfertTo_DZG_Table(VariableData){
   
var tableVariableName= new Array("Model", "ManualType", "ManualNumber", "B_ChapterName","B_ChapterNumber", "B_SectionName", "B_SectionNumber","Item Number", "Item Name","Doc Status");   
    var tableFileName = new Array();
    var tableVariable =new Array();
    var VariableValue;
    tableVariable.variableCount = 0;

$.writeln ("longueur tableau="+VariableData.chapterNameArray.length);
   
     // table initialisation
      $.writeln ("--------------------start of table initialisation---------------------");
    for(boucle1=0;boucle1<VariableData.chapterNameArray.length;boucle1++){
        for(boucle2=0;boucle2<30;boucle2++){
              tableVariable[boucle1,boucle2]="---";             
              }
          }
      $.writeln ("--------------------end of table initialisation-----------------------");
    // end of initialisation
      
    // table filling
    $.writeln ("*************************start of filling******************");
//for(var i = 0; i < VariableData.chapterNameArray.length; i++){
     for(var i = 0; i < 50; i++){   // temporary to have less result
  
            var FileName=File(VariableData.chapterNameArray[i ]).displayName;
            var VariableName=VariableData.variableNameArray;
            var VariableValue=VariableData.variableDefArray[i ];
           
            var IndexFileName=GetIndexOf(tableFileName, FileName);
            var IndexVariableName=GetIndexOf(tableVariableName, VariableName);
           
           
            if(IndexFileName == -1){
                tableFileName.push(FileName);
               IndexFileName=GetIndexOf(tableFileName, FileName);
               $.writeln("nouveau fichier"+ FileName+"index nouveau fichier"+IndexFileName);
               }
            if(IndexVariableName== -1){
                tableVariableName.push( VariableName);
                IndexVariableName=GetIndexOf(tableVariableName, VariableName);
                }
            if(VariableValue===undefined){
                VariableValue="_";
                }
            tableVariable[IndexFileName,IndexVariableName]=VariableValue;
            $.writeln("-------tableVariable["+IndexFileName+","+IndexVariableName+"]="+VariableValue);
           
            }
        $.writeln ("*******************end of filling**********************");
// end of filling

// loop to check value inside  table
           $.writeln ("////////////////////////////check of the table//////////////////////////");
          for(boucle1=0;boucle1<5;boucle1++){
         $.writeln( "=============boucle1="+ boucle1+"============");
          for(boucle2=0;boucle2<10;boucle2++){
              $.writeln("tableVariable["+boucle1+","+boucle2+"]="+ tableVariable[boucle1,boucle2]);
             
              }
          }
      $.writeln ("////////////////////////////////////end of check///////////////////////////");
// end of loop    

//FcWriteTableau(tableVariable);
//ExtractTableau(tableFileName,tableVariableName,tableVariable);

and here the console output :

in paragraph "check the table" the loop  repeat each time the last ten variables.

entre dans ExportVariable

longueur tableau=105

--------------------start of table initialisation---------------------

--------------------end of table initialisation-----------------------

*************************start of filling******************

nouveau fichierTitlePage_FAA_MDDG.fmindex nouveau fichier0

-------tableVariable[0,10]=XXXXXX

-------tableVariable[0,11]=The xxxxxxx Company

-------tableVariable[0,12]=Title Template

-------tableVariable[0,5]=Preface

-------tableVariable[0,6]=E

-------tableVariable[0,3]=Title Page_DZG

-------tableVariable[0,4]=1

-------tableVariable[0,13]=14

-------tableVariable[0,0]=123

-------tableVariable[0,14]=2017

-------tableVariable[0,2]=A630Z004-01

-------tableVariable[0,15]=2013

-------tableVariable[0,9]=

-------tableVariable[0,16]=Dispatch Deviations Guide (DDG)

-------tableVariable[0,1]=Dispatch Deviations Guide

-------tableVariable[0,17]=Jul 20, 2017

nouveau fichierP-00-00TOC.fmindex nouveau fichier1

-------tableVariable[1,1]=Dispatch Deviations Guide

-------tableVariable[1,7]=00

-------tableVariable[1,9]=

-------tableVariable[1,2]=B630Z004-02

-------tableVariable[1,0]=456

-------tableVariable[1,3]=Section List_V

-------tableVariable[1,5]=Preface_V

-------tableVariable[1,6]=E

-------tableVariable[1,17]=Jul 20, 2017

nouveau fichierP-00-01-00_FAA.fmindex nouveau fichier2

-------tableVariable[2,1]=Dispatch Deviations Guide

-------tableVariable[2,18]=10

-------tableVariable[2,9]=

-------tableVariable[2,13]=14

-------tableVariable[2,2]=C630Z004-03

-------tableVariable[2,19]=14

-------tableVariable[2,0]=789

-------tableVariable[2,7]=00-01-00

-------tableVariable[2,3]=Revision Record_V

-------tableVariable[2,5]=Preface_V

-------tableVariable[2,6]=E

-------tableVariable[2,20]=Rev Rec

-------tableVariable[2,21]=D630Z004-01

-------tableVariable[2,22]=XX

-------tableVariable[2,23]=D630Z004-XXX

nouveau fichier4-00-00TOC.fmindex nouveau fichier3

-------tableVariable[3,1]=Dispatch Deviations Guide

-------tableVariable[3,0]=963

-------tableVariable[3,2]=D630Z004-01

-------tableVariable[3,20]=General_V

-------tableVariable[3,6]=H

-------tableVariable[3,7]=00

-------tableVariable[3,5]=Miscellaneous_V

-------tableVariable[3,9]=

-------tableVariable[3,17]=Jul 20, 2017

nouveau fichier4-00-01-00.fmindex nouveau fichier4

-------tableVariable[4,19]=MML Revision Number

*******************end of filling**********************

////////////////////////////check of the table//////////////////////////

=============boucle1=0============

tableVariable[0,0]=963

tableVariable[0,1]=Dispatch Deviations Guide

tableVariable[0,2]=D630Z004-01

tableVariable[0,3]=Revision Record_V

tableVariable[0,4]=1

tableVariable[0,5]=Miscellaneous_V

tableVariable[0,6]=H

tableVariable[0,7]=00

tableVariable[0,8]=---

tableVariable[0,9]=

=============boucle1=1============

tableVariable[1,0]=963

tableVariable[1,1]=Dispatch Deviations Guide

tableVariable[1,2]=D630Z004-01

tableVariable[1,3]=Revision Record_V

tableVariable[1,4]=1

tableVariable[1,5]=Miscellaneous_V

tableVariable[1,6]=H

tableVariable[1,7]=00

tableVariable[1,8]=---

tableVariable[1,9]=

=============boucle1=2============

tableVariable[2,0]=963

tableVariable[2,1]=Dispatch Deviations Guide

tableVariable[2,2]=D630Z004-01

tableVariable[2,3]=Revision Record_V

tableVariable[2,4]=1

tableVariable[2,5]=Miscellaneous_V

tableVariable[2,6]=H

tableVariable[2,7]=00

tableVariable[2,8]=---

tableVariable[2,9]=

=============boucle1=3============

tableVariable[3,0]=963

tableVariable[3,1]=Dispatch Deviations Guide

tableVariable[3,2]=D630Z004-01

tableVariable[3,3]=Revision Record_V

tableVariable[3,4]=1

tableVariable[3,5]=Miscellaneous_V

tableVariable[3,6]=H

tableVariable[3,7]=00

tableVariable[3,8]=---

tableVariable[3,9]=

=============boucle1=4============

tableVariable[4,0]=963

tableVariable[4,1]=Dispatch Deviations Guide

tableVariable[4,2]=D630Z004-01

tableVariable[4,3]=Revision Record_V

tableVariable[4,4]=1

tableVariable[4,5]=Miscellaneous_V

tableVariable[4,6]=H

tableVariable[4,7]=00

tableVariable[4,8]=---

tableVariable[4,9]=

////////////////////////////////////end of check///////////////////////////

RĆ©sultat : undefined

So how do you manage multidimensionnal array

i can't do like "extend of the week " as i don't know number of variables nor number of files.

thank

TOPICS
Scripting

Views

266

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 Beginner , Feb 09, 2018 Feb 09, 2018

hello forum

i have found the response here :

How to create a multi dimensional array in Javascript? - Stack Overflow .

to have mutidimensionnal array we have to declare an array in an another array .

here the final code:

function TransfertTo_DZG_Table(VariableData){

   

var tableVariableName= new Array("Model", "ManualType", "ManualNumber", "B_ChapterName","B_ChapterNumber", "B_SectionName", "B_SectionNumber","Item Number", "Item Name","Doc Status");   

    var tableFileName = new Array();

    var tab

...

Votes

Translate

Translate
Community Beginner ,
Feb 09, 2018 Feb 09, 2018

Copy link to clipboard

Copied

LATEST

hello forum

i have found the response here :

How to create a multi dimensional array in Javascript? - Stack Overflow .

to have mutidimensionnal array we have to declare an array in an another array .

here the final code:

function TransfertTo_DZG_Table(VariableData){

   

var tableVariableName= new Array("Model", "ManualType", "ManualNumber", "B_ChapterName","B_ChapterNumber", "B_SectionName", "B_SectionNumber","Item Number", "Item Name","Doc Status");   

    var tableFileName = new Array();

    var tableVariable =new Array();

    var VariableValue;

    tableVariable.variableCount = 0;

$.writeln ("longueur tableau="+VariableData.chapterNameArray.length);

  // table filling

    $.writeln ("*************************start of filling******************");

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

    // for(var i = 0; i < 50; i++){   // temporary

  

            var FileName=File(VariableData.chapterNameArray[i ]).displayName;

            var VariableName=VariableData.variableNameArray;

            var VariableValue=VariableData.variableDefArray[i ];

           

            var IndexFileName=GetIndexOf(tableFileName, FileName);

            var IndexVariableName=GetIndexOf(tableVariableName, VariableName);

           

           

            if(IndexFileName == -1){

                tableFileName.push(FileName);

               IndexFileName=GetIndexOf(tableFileName, FileName);

               tableVariable[IndexFileName]=new Array();

               $.writeln("nouveau fichier"+ FileName+"index nouveau fichier"+IndexFileName);

               }

            if(IndexVariableName== -1){

                tableVariableName.push( VariableName);

                IndexVariableName=GetIndexOf(tableVariableName, VariableName);

                }

            if(VariableValue===undefined){

                VariableValue="_";

                }

            tableVariable[IndexFileName][IndexVariableName]=VariableValue;

            //$.writeln("-------tableVariable["+IndexFileName+","+IndexVariableName+"]="+VariableValue);

           

            }

        $.writeln ("*******************end of filling**********************");

// end of filling

   

regards

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