Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 2 Jahren, 8 Monaten
Letzter Beitrag:
vor 2 Jahren, 7 Monaten
Beteiligte Autoren:
Curtis, DerekT, Fabrice Harari, Igor Pobi

[WX20] Array of Arrays

Startbeitrag von Curtis am 25.06.2015 22:19

http://doc.windev.com/en-US/?1514030&name=Simple_arrays#ELTPARAGRAPHE000124

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.

Antworten:

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

von Fabrice Harari - am 26.06.2015 11:16
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


von Curtis - am 26.06.2015 13:32
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

von Igor Pobi - am 26.06.2015 13:35
Hey thanks! I guess PCSoft needs to update their documentation.

von Curtis - am 26.06.2015 14:41
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


von Curtis - am 07.07.2015 14:12
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

von DerekT - am 07.07.2015 16:47
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.