Announcement

Collapse
No announcement yet.

Array Question

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Array Question

    Is it possible to use a two dimensional array in a formula? The only examples I have run across use one dimensional arrays.
    pa-kay

  • #2
    Hello pa-kay,

    Yes you can use multidimensional arrays.

    PHP Code:
    var aArray = new Array(2);
    for (
    02; ++i) {
        
    aArray[i] = new Array(10);

    aArray[0] will contain 10 elements from aArray[0][0] to aArray[0][9] and likewise for aArray[1].
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Full support of the Core objects in JavaScript 1.5 are included in EFS. Below is an example from Netscape's Core JavaScript Reference site.

      ---------------
      Example 2: Two-dimensional array. The following code creates a two-dimensional array and assigns the results to myVar.

      PHP Code:
      myVar="Multidimensional array test; "
      = new Array(4)
      for (
      i=04i++) {
         
      a[i] = new Array(4)
         for (
      j=04j++) {
            
      a[i][j] = "["+i+","+j+"]"
         
      }
      }
      for (
      i=04i++) {
         
      str "Row "+i+":"
         
      for (j=04j++) {
            
      str += a[i][j]
         }
         
      myVar += str +"; "

      This example assigns the following string to myVar (line breaks are used here for readability):

      Multidimensional array test;
      Row 0:[0,0][0,1][0,2][0,3];
      Row 1:[1,0][1,1][1,2][1,3];
      Row 2:[2,0][2,1][2,2][2,3];
      Row 3:[3,0][3,1][3,2][3,3];
      Regards,
      Jay F.
      Product Manager
      _____________________________________
      Have a suggestion to improve our products?
      Click Support --> Request a Feature in eSignal 11

      Comment

      Working...
      X