Skip to Content
0

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

Nov 08, 2017 at 09:01 AM

141

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Mustafa Bensan Nov 08, 2017 at 09:31 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 09, 2017 at 03:27 AM
0

Hello Mustafa,

Many thanks for your enlightened answer. Quite helpful.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

You're welcome Denny.

0