MultiDIM Array Quirks

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
user5274
Junior Coder
Posts: 43
Joined: Tue Aug 04, 2020 9:35 am

MultiDIM Array Quirks

Post by user5274 » Mon May 24, 2021 4:26 am

Hi again :D some time back I came across these quirks and hopefully can get a workaround or solution. The first is reDim'ing multidimensional arrays, the following code creates 2 separate arrays THISARRAY_2 and THISARRAY_%WW%, of course the second array is unexpected.

Code: Select all

Let>WW=2

//make array with 8 elements
ArrayDim>THISARRAY_%WW%,8,integer

//now make it with 11 elements
ArrayDim>THISARRAY_%WW%,11,integer

**BREAKPOINT**
Exit>
Now the above lead to the second quirk, thinking I could delete the array and start from scratch.

Code: Select all

Let>WW=2
ArrayDim>THISARRAY_%WW%,8,integer

DelArray>THISARRAY_%WW%
//array has not been deleted
Assigned>THISARRAY_2_8,TMP
MDL>Assigned=%TMP%

DelArray>THISARRAY_2
//array has been deleted
Assigned>THISARRAY_2_8,TMP
MDL>Assigned=%TMP%

**BREAKPOINT**
Exit>
DelArray cannot delete THISARRAY_%WW%

user5274
Junior Coder
Posts: 43
Joined: Tue Aug 04, 2020 9:35 am

Re: MultiDIM Array Quirks

Post by user5274 » Mon May 24, 2021 5:32 am

One more quirk, BUT i found a workaround to

Code: Select all

Let>WW=2
Let>QINDX=55,66,77,88,99,11
Separate>QINDX,COMMA,THISARRAY_%WW%,integer
This creates an array THISARRAY_%WW% instead of THISARRAY_2, but the workaround below works

Code: Select all

Let>WW=2
Let>QINDX=55,66,77,88,99,11
Separate>QINDX,COMMA,TMPARRAY,integer
ArrayCopy>TMPARRAY,,THISARRAY_%WW%
DelArray>TMPARRAY

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: MultiDIM Array Quirks

Post by Grovkillen » Mon May 24, 2021 6:27 am

Tried this?

Code: Select all

Let>WW=2
Let>QINDX=55,66,77,88,99,11
Separate>QINDX,COMMA,{THISARRAY_%WW%},integer
Let>ME=%Script%

Running: 15.0.27
version history

user5274
Junior Coder
Posts: 43
Joined: Tue Aug 04, 2020 9:35 am

Re: MultiDIM Array Quirks

Post by user5274 » Mon May 24, 2021 9:05 am

Just did :) it made these vars

Code: Select all

0: {THISARRAY_%WW%}_1=55
0: {THISARRAY_%WW%}_2=66
0: {THISARRAY_%WW%}_3=77
0: {THISARRAY_%WW%}_4=88
0: {THISARRAY_%WW%}_5=99
0: {THISARRAY_%WW%}_6=11
0: {THISARRAY_%WW%}_COUNT=6

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: MultiDIM Array Quirks

Post by Grovkillen » Mon May 24, 2021 9:34 am

Code: Select all

Let>WW=2
Let>QINDX=55,66,77,88,99,11
Separate>QINDX,COMMA,{"THISARRAY_%WW%"},integer
Same thing using this?
Let>ME=%Script%

Running: 15.0.27
version history

user5274
Junior Coder
Posts: 43
Joined: Tue Aug 04, 2020 9:35 am

Re: MultiDIM Array Quirks

Post by user5274 » Tue May 25, 2021 10:04 am

Same, creates {"THISARRAY_%WW%"} array

Just so this thread does not get lost in it main purpose I will re-list the quirks:

Code: Select all

ArrayDim>THISARRAY_%WW%,8,integer
ArrayDim>THISARRAY_%WW%,11,integer
Re-dim'ing a multi-dim array creates an unexpected array

Code: Select all

DelArray>THISARRAY_%WW%
Cannot delete a multi-dim array

Code: Select all

Separate>QINDX,COMMA,THISARRAY_%WW%,integer
Cannot separate into a multi-dim array

See previous posts for full examples

user5274
Junior Coder
Posts: 43
Joined: Tue Aug 04, 2020 9:35 am

Re: MultiDIM Array Quirks

Post by user5274 » Thu May 27, 2021 10:13 am

Could I get confirmation that these quirks are intended and I can continue to find workarounds on my own. Thank you.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: MultiDIM Array Quirks

Post by Marcus Tettmar » Fri May 28, 2021 9:18 am

ArrayDim is designed for single dimension arrays only.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts