Thanks to those who responded about the workspace quirk, but I believe I have found 
the cause of the errors 
encountered saving a workspace.  A bit more research and a sleep has let me identify 
the problem much more succinctly.
I am still not sure of the solution, however.  

It seems that there is some triggers in mapinfo that determines the version that a 
workspace is written to. The trigger that 
says that queries should be saved (and thus save the workspace as version 6) is not 
pulled if the queries are made
in a Mapbasic program.  Run the same code from the Mapbasic window, and the triggers 
are pulled and the workspace
saves as it should.

I have a simple Mapbasic program that demonstrates this if anyone is interested.  you 
will need to change table paths, 
fields and selection examples to suit.

Compile the code in MapBasic, run the program and look at the workspace.  MapInfo will 
save the workspace 
as an earlier version and thus not save queries.  I

However, if you paste the same code into the Mapbasic window, you get the same result 
on the screen, 
but if you save the workspace at this stage, you get a version 6 workspace with 
queries and map included.  
I'd suppose the trigger to save the workspace as version 6 has been pulled when the 
code is run from MapInfo.


If you have a simple mapBasic routine like this below:

Declare Sub Main

Sub Main

'Try pasting the code from here:
'XXXXXXXXXXXXXXXXXXXXX
Close All Interactive
Open Table "C:\FMapDemo2001\FMapTab\T_PAD_CUR.TAB" As Table1 Interactive
Open Table "C:\FMapDemo2001\FMapTab\Labels\00036.TAB" As Table2 Interactive
Select * from Table1 where C_Farm = "00036" into Selection1
Select * from Table2 where Column = "Block:SubBlock" into Selection2
Map From Selection1, Selection2
'XXXXXXXXXXXXXXXXXXXXX
'To here in the mapBasic window.

End Sub


You end up with a map of the two selection tables.
Now if you save the workspace, you get:

!Charset WindowsLatin1
Open Table "C:\Program Files\MapInfo\Professional 6.5\DATA\Map_Data\Austrlia\AUSTCAPS" 
As AUSTCAPS Interactive
Open Table "C:\Program Files\MapInfo\Professional 6.5\DATA\Map_Data\Austrlia\AUSTRLIA" 
As AUSTRLIA Interactive

In other words, all reference to the selections are lost, and the version of the 
workspace is not specified.

However if you paste the code into the MapBasic window, select the code and run it.

You get the same map as before, but this time if you save the workspace, you get the 
following.

!Workspace
!Version 600
!Charset WindowsLatin1
Open Table "C:\Program Files\MapInfo\Professional 6.5\DATA\Map_Data\Austrlia\AUSTCAPS" 
As AUSTCAPS Interactive
Open Table "C:\Program Files\MapInfo\Professional 6.5\DATA\Map_Data\Austrlia\AUSTRLIA" 
As AUSTRLIA Interactive
Select *  from AUSTRLIA  where STATE = "Queensland"  into Selection1 noselect  
Select *  from AUSTCAPS  where Place_Name = "Brisbane"  into Selection2 noselect  

Map From Selection2,Selection1 
  Position (0.40625,0.53125) Units "in"
  Width 5.29167 Units "in" Height 2.80208 Units "in" 
Set Window FrontWindow() ScrollBars Off Autoscroll On
Set Map
  CoordSys Earth Projection 1, 0
Set Map COmmand continues.........

In other words, running the same code in MapInfo has triggered a need to save the 
workspace as version 6 and thus you
get all the queries.  Anyone think of a way of pulling the trigger in code?

Robert Crossley 
Robert Crossley & Associates
9 Short St
New Brighton NSW 2483

P: 02 6680 1309
F: New Connection
M: 0419 718 642
E: [EMAIL PROTECTED]




_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to