export, import arrays in JS

János Losonczi shared this question 1 year ago
Answered

Dear All,


I have arrays containing text or binary data in JS.

I'd like to write these data into files, then read them.

Do you have any idea?

Best regards,

János Losonczi

Comments (4)

photo
1

Please paste an example here

photo
1

This is an excerpt of my script. I'd like to write AllKitePointsPrevious array to file.

for(var i = 0 ; i < CountOfDartsKitesByGeneration[GenNum][2] ; i++)
   {
   AllKitePointsPrevious[i] = new Array(KiteNumberOfPoints * 3);
   for(var j = 0 ; j < KiteNumberOfPoints ; j++)
      {
      AllKitePointsPrevious[i][j * 3 + ShiftLabel] = AllKiteLabelsActual[i][(j + KiteNumberOfNonPoints)]; // save label
      AllKitePointsPrevious[i][j * 3 + ShiftXcoord] = ggbApplet.getXcoord(AllKiteLabelsActual[i][(j + KiteNumberOfNonPoints)]);
      AllKitePointsPrevious[i][j * 3 + ShiftYcoord] = ggbApplet.getYcoord(AllKiteLabelsActual[i][(j + KiteNumberOfNonPoints)]);
      ggbApplet.evalCommand('SetVisibleInView('+ AllKitePointsPrevious[i][j * 3 + ShiftLabel] +' ,' + 1 + ',' + 'false' +')');
      }
   }

photo
1

Probably the easiest solution is to put the export data in the spreadsheet then you can copy & paste from there. OK?

photo
1

The operations - like I paste above - occur many times, and many forms in my script. This way the "spreadsheet" solution unfortunately is not a suitable one. I think, it would be useful to implement an appropriate export command in one of the next GG versions in the future. Thank you for your help.

© 2019 International GeoGebra Institute