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
