Skip to Content
avatar image
Former Member

2-D array(two/multi dimensional array) example in Design Studio?

Hi Gurus,

Can anyone give me a simple example of 2-D array in Design Studio?

like:
var Arr_2D = ["",""];

Arr_2D[0][0].push("IBM");

Arr_2D[0][1].push("Dell");

Arr_2D[1][1].push("SAP");

........

but Arr_2D[0][0].push("IBM"); is a bad code, not allowed in DS

can anyone help? Many thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 08, 2017 at 09:31 AM

    Hi Denny,

    You cannot create multi dimensional arrays in Design Studio. A workaround is to create a single dimensional array containing comma-delimited strings representing a "sub-array". You can then convert the sub-array string elements into an array using the split() method and nest more sub-arrays in a similar manner. An example of the coding of such an array might look like this:

    var array = ["IBM,DELL","HP,SAP"];
    
    var array0 = array[0].split(",");
    var array1 = array[1].split(",");
    
    var array00 = array0[0];
    var array01 = array0[1];
    var array10 = array1[0];
    var array11 = array1[1];
    

    Regards,

    Mustafa.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 09, 2017 at 03:27 AM

    Hello Mustafa,

    Many thanks for your enlightened answer. Quite helpful.

    Add comment
    10|10000 characters needed characters exceeded