Multidimensional Array iLogic

Multidimensional Array iLogic

Anonymous
Not applicable
3,069 Views
4 Replies
Message 1 of 5

Multidimensional Array iLogic

Anonymous
Not applicable

I'm trying to figure out how to create an empty 2D array in iLogic and then fill the array like a table. The VBA equivalent would go something like this:

 

Dim MyArray(0 To 1, 0 To 1) As String
MyArray(0, 0) = "00"
MyArray(0, 1) = "01"
MyArray(1, 1) = "11"
MyArray(1, 0) = "10"

MsgBox MyArray(0, 1) 'outputs string "01"

0 Likes
Accepted solutions (1)
3,070 Views
4 Replies
Replies (4)
Message 2 of 5

JelteDeJong
Mentor
Mentor

The ilogic/vb.net equivalent:

Dim myArray(1,1) As String
myArray(0,0) = "00"
myArray(0,1) = "01"
myArray(1,0) = "10"
myArray(1,1) = "11"
MsgBox( myArray(0, 1)) 'outputs string "01"

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 5

Anonymous
Not applicable

Thank you for your reply.  I was actually able to get my original code (see below) to work. I identified the wrong problem. The problem wasn't the array, it was putting that array in a custom table (see line 23). My desired output is attached (see screen shottable screenshot.png

Sub Main 

        Dim oDrawDoc 		As DrawingDocument
	Dim oSheet 	        As Sheet
	Dim oTitles() 		As String
	Dim oContents() 	As String
	Dim oCustomTable        As CustomTable

    oDrawDoc = ThisDoc.Document
    oSheet = oDrawDoc.ActiveSheet
'    oTitles = {"DWG TYPE", "FAB STATUS", "DRAWING NUMBER", "REV. NO.", "DESCRIPTION" }
	oTitles = {"DWG TYPE", "FAB STATUS"}
    
Dim MyArray(0 To 1, 0 To 1) As Object
MyArray(0, 0) = "00"
MyArray(0, 1) = "01"
MyArray(1, 1) = "11"
MyArray(1, 0) = "10"

MsgBox("myarray(0,0) = " & myarray(0,0))

	'	oCustomTable = oPSheet.CustomTables.Add("PRINT REQUEST FORM", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), 3, 4, oTitles, oContents)	
		oCustomTable = oSheet.CustomTables.Add("Sample Table", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), 2, 2, oTitles,MyArray) '''here's my problem line of code

end sub
0 Likes
Message 4 of 5

JelteDeJong
Mentor
Mentor
Accepted solution

it's maby a bit strange but you dont need a multi dimension array. The help states:

 


Optional input String array that specifies the contents of the table. The number of Strings must match the number of cells in the table, else an error will occur. This array of String is used to sequentially populate each row of the table

try the following array

Dim myArray(3) As String
myArray(0) = "00"
myArray(1) = "01"
myArray(2) = "10"
myArray(3) = "11"

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 5 of 5

Anonymous
Not applicable

I think I see what you're saying. It's a little counter intuitive. A multidimensional array is NOT required. The TOTAL number of cells must match the TOTAL number of data cells excluding the title cells. Thank you for clarifying that.

0 Likes