A number of tools I have created help users develop workspace files with maps providing visual information based upon queries. When the workspace is closed and re-opened, these queries have vanished and the important information is lost. Ticking "save queries in workspaces" under preferences makes no difference: if you create a query via a MapBasic tool, MapInfo just ignores it when saving the content of that workspace on shutdown. It really blows me away how poor this is - its a glaring oversight that I can't believe hasn't been addressed. In the meantime, what workaround is there for this baffling bug?
There is no MapBasic method for saving queries to workspaces that you can include in your program to address this. You could of course force queries to be saved as full tables, but cluttering up our network with unnecessary files seems daft when MapInfo is perfectly capable of saving the exact same queries inside workspaces
if they were entered by the user. We could just instruct the user to run the query themselves, but isn't the point of MapBasic programming to preform these tasks so people don't have to?
Apparently, we can force MapInfo to 'remember' to save the queries if we pass them through the Run Command statement. Except it seems to stumble on queries that use variables. An example query I would like MapInfo to understand is:Select * From tAreas where tName = tYourArea Into _YOURAREA
So how does one go about converting that syntax into the new syntax required for it to work with Run Command? Just enclosing the full query in quotes does not work. Enclosing everything in quotes except the variables:Run Command "Select * From " + tAreas + " where " + tName + " = " + tYourArea + "Into _YOURAREA"
...did not work for me either. MapInfo rather aimlessly complains that it: "Found [=] while searching for [a string constant]"
Any help would be gratefully appreciated. And if MapInfo can fix this bug that would be great too. We really shouldn't really need to find a workaround for this.
Knowledge Community Shared Account