Workspaces may only contain constructs that are legal in the MapBasic window, and you cannot define array variables in the MapBasic window.
There is no point in allowing array variables in the MapBasic window, because there's no way to abstract repetitive sections of code to use an index into the array. Recall that you're also prohibited from using flow control statements such as do..case, for..next, and do..loop. So, as stupid as it may first appear, you have to do something like this in a workspace: Dim layFrameX1_1 as float Dim layFrameX1_2 as float Dim layFrameX1_3 as float Dim layFrameX1_4 as float Dim layFrameX1_5 as float Dim layFrameX1_6 as float Dim layFrameX1_7 as float Dim layFrameX1_8 as float Dim layFrameX1_9 as float Dim layFrameX1_10 as float Dim layFrameX1_11 as float layFrameX1_1 = 19.2201 layFrameX1_2 = 1.2396 layFrameX1_3 = 1.2396 layFrameX1_4 = 1.2396 layFrameX1_5 = 1.2396 layFrameX1_6 = 1.2396 layFrameX1_7 = 5.7965 layFrameX1_8 = 10.3104 layFrameX1_9 = 14.7806 layFrameX1_10 = 1.2396 layFrameX1_11 = 1.2396 If you don't prefer to have 11 variables, you might want to make use of the Undim statement. Dim layFrameX1 as float layFrameX1 = 19.2201 '...do stuff Undim layFrameX1 Dim layFrameX1 as float layFrameX1 = 1.2396 '...do stuff Undim layFrameX1 Dim layFrameX1 as float layFrameX1 = 1.2396 '...do stuff Undim layFrameX1 You can remove the Undim/Dim pairs in the middle but a workspace should always Undim any variable declared in it. Hope this helps Spencer -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ben A Greenberg Sent: Tuesday, March 21, 2006 11:32 AM To: MapInfo-L (E-mail) Subject: [MI-L] Dimensioning arrays in workspaces I'm trying to dimension an array in a workspace, and keep getting a syntax error. Does MI not allow this? CODE: Dim layFrameX1(11) as float layFrameX1(1) = 19.2201 layFrameX1(2) = 1.2396 layFrameX1(3) = 1.2396 layFrameX1(4) = 1.2396 layFrameX1(5) = 1.2396 layFrameX1(6) = 1.2396 layFrameX1(7) = 5.7965 layFrameX1(8) = 10.3104 layFrameX1(9) = 14.7806 layFrameX1(10) = 1.2396 layFrameX1(11) = 1.2396 Any ideas why this isin't working? _______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l _______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l
