Thanks Bill, Uffe, and Trey, Looks like I'm stuck. This job is only a temporary to fill in for someone else, and they don't like programming. So the only programming tools I have are the free ones like JAVA, C#, etc, which I don't know well enough to integrate into MapInfo. I know enough VB to get by, but I don't have a license for it. I think I should look into getting a license for at home so I don't lose what skills I have.
In the mean time, I can create some small bits of code that will help in other tasks and they will work in the MB window. Trey's suggestion helps, but I was hoping to be able to just run the code once and have done with it. There are a lot of records and different object styles to apply. I thought I would try to make things easier for my predecessor when she returns. Anyways, thanks again. _________________________ Don Mitchell GIS Technician (IMS) City of St.Thomas Message: 3 Date: Sun, 3 Sep 2006 07:48:10 +0200 From: "Uffe Kousgaard" <[EMAIL PROTECTED]> Subject: Re: [MI-L] Looping in MapInfo MapBasic Window To: "mapinfo-l" <[email protected]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" > From: Hughes, Colleen / Don Mitchell > > Is it possible to perform looping or to test for things (like If Then) > from the MapBasic window. No, but you can use automation, i.e. use VB for instance for calling the mapbasic commands and then use VB logic for looping and if-then. Examples on how to do this, can be seen in the mapbasic folder, but I'm not sure how to get access to that without mapbasic? Kind regards Uffe Kousgaard www.routeware.dk ------------------------------ Message: 4 Date: Sun, 3 Sep 2006 06:30:23 -0600 From: Bill Thoen <[EMAIL PROTECTED]> Subject: Re: [MI-L] Looping in MapInfo MapBasic Window To: "Hughes, Colleen / Don Mitchell" <[EMAIL PROTECTED]> Cc: [email protected] Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=us-ascii Looks like several messages posted several days ago are finally coming up... Anyway, you can't do any looping or branching in the MapBasic window; you have to get MapBasic to do that, sorry. On Thu, Aug 31, 2006 at 09:35:07AM -0400, Hughes, Colleen / Don Mitchell wrote: > Hi All, > > I'm slowly trying to learn MapBasic with the MapBasic window in > MapInfo and the User Guides for MapBasic that I downloaded. I'm > trying to change the symbol for a selection using mapbasic. When I > look up the commands in the reference guide, it states that the Do > While statement isn't supported in the MapBasic window, nor is any of > the other looping statements nor is the If Then statement. Is it > possible to perform looping or to test for things (like If Then) from the MapBasic window. > > I don't have Mapbasic, other than from within MapInfo, but thought I > could write some simple scripts to automate some of the repetitive > tasks I have and just copy them into the mapbasic window to run them. > > The code that I have so far: > > ---------------------------------------------------------------------- > -- > ----------------------------- > select * from OverDue where Due_Tested = "NO BFP" into NoBFPtab Dim > bfpobj As Object, bfpsymbol As Symbol bfpsymbol = MakeSymbol(34,0,6) > Fetch First From NoBFPtab Do While Not EOT(NoBFPtab) > bfpobj = NoBFPtab.obj > Alter Object bfpobj > Info OBJ_INFO_SYMBOL, bfpsymbol > Update NoBFPtab Set obj = bfpobj > Fetch Next From NoBFPtab > ---------------------------------------------------------------------- > -- > ----------------------------- > > Any help is be appreciated. > Don > _______________________________________________ > MapInfo-L mailing list > [email protected] > http://www.directionsmag.com/mailman/listinfo/mapinfo-l ------------------------------ Message: 5 Date: Sun, 3 Sep 2006 10:34:57 -0500 From: Trey Pattillo <[EMAIL PROTECTED]> Subject: Re: [MI-L] Looping in MapInfo MapBasic Window To: [email protected] Cc: "Hughes, Colleen / Don Mitchell" <[EMAIL PROTECTED]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="us-ascii" leaving the mapbasic window open is one of the best ways to learn what is going on behind the scene a big drawback is that some the most complex commands, such as changing an object style [in your case], is not displayed so you will need some help there and also a list of the command values from mapbasic definition file [.def] to reference such as for ObjectInfo(obj, 1) returns the object type where 1 is refered to as OBJ_INFO_TYPE you can do some basic loop if your work is on a small amount of rows which might be in your case of processing for OverDue records I'm talking about on doing this one something less than maybe 100 records you just highlight all the rows to "run" and hit enter '[highlight these only 1 DIM per line though] Dim bfpobj As Object Dim bfpsymbol As Symbol select * from OverDue where Due_Tested = "NO BFP" into NoBFPtab fetch first from NoBFPtab '[end highlight above] '[highlight these and just keep hitting enter] [would be the DO/WHILE line] bfpobj = NoBFPtab.obj Alter Object bfpobj Info OBJ_INFO_SYMBOL, bfpsymbol Update NoBFPtab Set obj = bfpobj Fetch Next From NoBFPtab '[end highlight above] [would be the END/WEND line] '[do these when finished] UNDim bfpobj UNDim bfpsymbol '[end finish] you can also use a integer counter in the same manner DIM iRow as Integer '[begin highlight] iRow=1 '.... '......processing statements here '.. like FETCH Rec iRow From TableName '.... iRow=iRow+1 '[end highlight] UNDim iRow The UNDIM is used only in MB-Window and Integrated Mapping [VB,Delphi,...] If you do not run it if another application later on tries to use it the application will fail [already defined] and also if a program is running and you happen to pick a name that is in use your DIM will fail and using UNDIM will cause the application to fail [not available for app] You can save the MapBasic Window to a text file but the MB-Window does not have a "load from" so open the text file in NotePad and copy/paste to the window to have reusable code Also in SQL Query you can save/load the query, although the file has a special format it is text and makes sense so you can use it as a template, of course if the MB-Win is open then you get the full command. On Thu 31 Aug 2006 08:35, Hughes, Colleen / Don Mitchell wrote: > Hi All, > > I'm slowly trying to learn MapBasic with the MapBasic window in > MapInfo and the User Guides for MapBasic that I downloaded. I'm > trying to change the symbol for a selection using mapbasic. When I > look up the commands in the reference guide, it states that the Do > While statement isn't supported in the MapBasic window, nor is any of > the other looping statements nor is the If Then statement. Is it > possible to perform looping or to test for things (like If Then) from the MapBasic window. > > I don't have Mapbasic, other than from within MapInfo, but thought I > could write some simple scripts to automate some of the repetitive > tasks I have and just copy them into the mapbasic window to run them. > > The code that I have so far: > > ---------------------------------------------------------------------- > -- > ----------------------------- > select * from OverDue where Due_Tested = "NO BFP" into NoBFPtab Dim > bfpobj As Object, bfpsymbol As Symbol bfpsymbol = MakeSymbol(34,0,6) > Fetch First From NoBFPtab Do While Not EOT(NoBFPtab) > bfpobj = NoBFPtab.obj > Alter Object bfpobj > Info OBJ_INFO_SYMBOL, bfpsymbol > Update NoBFPtab Set obj = bfpobj > Fetch Next From NoBFPtab > ---------------------------------------------------------------------- > -- > ----------------------------- > > Any help is be appreciated. > Don -- Trey Pattillo Failure is not an option.... It comes standard with all Microsoft products. ------------------------------ _______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l End of MapInfo-L Digest, Vol 11, Issue 5 **************************************** _______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l
