PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WX20] Array of Arrays
[WX20] Array of Arrays
Iniciado por guest, 26,jun. 2015 00:19 - 6 respuestas
Publicado el 26,junio 2015 - 00:19
http://doc.windev.com/en-US/…

Has anyone with the Final version of WX20 been able to create an array of arrays? I keep getting the below error when trying to initialize an array of arrays.

Error:'array' is a WLanguage keyword, its use is incorrect in this case.
Publicado el 26,junio 2015 - 13:16
Hi Curtis,

I haven't tried, but one thing is sure... If you show us JUST the error message, and not the corresponding code, it's going to be hard to help

Best regards
Publicado el 26,junio 2015 - 15:32
Well there is only one line of code, taken right from the documentation. I have a feeling it wasn't included in the final release.

arrMyArray is array of string array
Publicado el 26,junio 2015 - 15:35
Quote
Curtis

Well there is only one line of code, taken right from the documentation. I have a feeling it wasn't included in the final release.




arrMyArray is array of string array


I tested this ....

This combination works :)

arrMyArray is array of arrays of string
Publicado el 26,junio 2015 - 16:41
Hey thanks! I guess PCSoft needs to update their documentation.
Publicado el 07,julio 2015 - 16:12
I am failing to add an array to an array of arrays. I keep getting this error: "ArrayAdd function called. The two arrays to concatenate must have the same dimensions." I've tried declaring arrTwo many different ways.

arrOne is array of 0 by 2 strings arrTwo is array of array of string //arrTwo is array of array of 0 by 2 string //arrTwo is array of array of 2 string //arrTwo is array of 0 by 2 array of string //arrTwo is array of 2 array of string //arrTwo is array of 0 array of 2 string ArrayAddLine(arrOne,145362346086,40) ArrayAddLine(arrOne,654616841467,80) ArrayAdd(arrTwo,arrOne) // Error occurs on this line
Publicado el 07,julio 2015 - 18:47
Curtis

The error is correct as your arrays are not the same.
ArrayAdd() would be used to concatenate 2 identical arrays.

I have not played much with this feature but it seems it offers the opportunity to build multiple arrays (as normal) and store each one within an Array of Arrays.

What you cannot do is create an array of values and the store these in another array by assignment- despite what the function title may suggest.

What you need is to Process within a Loop - bit like building a treeview.

The result will be one array (not two as you have tried to use) containing, to continue the Treeview analogy 'Leafs & Nodes'

As such you will need to follow the (fairly lightweight I grant you) example in the docs. nArrIndex is int arrTwo is array of array of strings nArrIndex = Add(arrTwo) //This is the LOOP 1 - Array of Arrays Add(arrTwo[nArrIndex],145362346086) //Add array value 1 Add(arrTwo[nArrIndex],40) //Add array value 2 nArrIndex = Add(arrTwo) //This is the LOOP 2 Add(arrTwo[nArrIndex],654616841467) //Add array value 1 Add(arrTwo[nArrIndex],80) //Add array value 2 This will add your values as described.
HTH