Great! Thanks for the help Dan
--- In [email protected], Armando Scalise <armando.scalise@...> wrote: > > Conflicts can arise on succesive runs whenever you create create temporary > layers and resued the file name. It is safer to use GetTempFileName() and > then move the results to the final destination usging CopyDatabase() > > Also, always try yo avoid hardwired layernames. Instead, use the > layername returned by the command that loads or create the layer. > > The code belows should do the job. > > Cheers > > > Macro "testaddfield" > RunMAcro("addfield" , "New Layer", "newareas" , > "c:\\temp\\outputareas.dbd") > endmacro > > Macro "addfield" ( sExistingAreaLayer, sOutputLayerName, sOutputFile) > > linelayer = "lines" > newtitle = "newtitle" > > > linefile = GetTempFileName("lines.dbd") > converttolinedatabase(sExistingAreaLayer + "|", linefile, > {{"Label",linelayer},{"Layer Name",linelayer}}) > newlines = addlayer(,,"c:\\TEMP\\lines.dbd", linelayer) > > areafile = GetTempFileName("areas.dbd") > converttoareadatabase(newlines + "|",areafile, {{"Label", > sOutputLayerName},{"Layer Name", sOutputLayerName}}) > droplayer(,newlines) > > > newareas = addlayer(, sOutputLayerName, areafile, sOutputLayerName) > setlayer (newareas) > currview = GetLayer() > tblflag = gettablemodifyflag(currview) > fieldinfo = gettablestructure(currview) > for i = 1 to fieldinfo.length do > fieldinfo[i] = fieldinfo[i] + {fieldinfo[i][1]} > end > fieldinfo = fieldinfo + {{"Precinct","Character",16,0,"false", , , , , > , , null}} > modifytable(currview,fieldinfo) > > // Move to final destiantion > CopyDatabase(areafile, sOutputFile) > > > endmacro > > > > On Thu, Jul 4, 2013 at 3:35 PM, pdr_dan <dan@...> wrote: > > > ** > > > > > > Below is the pertinent portion. Occasionally we have issues with broken > > polygons especially after a lot of changes are made. I've found the easiest > > way to repair this is converting to lines and then back to areas. > > Afterwards I modify the table to add back the lost field and fill by > > tagging with the old table (just id, area and precinct 16*char). This was > > just an attempt at automating it. Thanks for any help > > > > converttolinedatabase("newareas|","c:\\TEMP\\lines.dbd", > > {{"Label","lines"},{"Layer Name","lines"}}) > > addlayer(,,"c:\\TEMP\\lines.dbd","lines") > > droplayer(,"newareas") // drop old newareas > > converttoareadatabase("lines|",homedir+newtitle+".dbd", > > {{"Label",newtitle},{"Layer Name","newareas"}}) > > droplayer(,"lines") > > addlayer(,"newareas",homedir+newtitle+".dbd","newareas") > > setlayer("newareas") > > currview = getview() > > tblflag = gettablemodifyflag(currview) > > fieldinfo = gettablestructure(currview) > > for i = 1 to fieldinfo.length do > > fieldinfo[i] = fieldinfo[i] + {fieldinfo[i][1]} > > end > > fieldinfo = fieldinfo + {{"Precinct","Character",16,0,"false", , , , , , , > > null}} > > modifytable(currview,fieldinfo) > > > > > > --- In [email protected], Armando Scalise <armando.scalise@> > > wrote: > > > > > > Please copy the exact code you are using, as well as screenshot of the > > > table structure. That could help in finding the problem. Also, is the > > > view joined to other views? > > > > > > > > > On Wed, Jul 3, 2013 at 7:19 PM, pdr_dan <dan@> wrote: > > > > > > > ** > > > > > > > > > > > > > > Hi, > > > > has anyone used this function in GISDK? I'm trying to modify a .bin > > table > > > > in a geographic layer to add a character field. I basically cut and > > pasted > > > > the example from the manual for the function but I'm getting the > > following > > > > error: > > > > "unable to modify table (by adding a hard-link) when the .BIN, .DCB or > > .BX > > > > files exist. Please remove or rename them and try again" > > > > This doesn't make sense to me as how could you modify a file that > > doesn't > > > > exist. I ran it again with the gettablemodifyflag() function and that > > came > > > > back as "true" so it is modifiable. Any ideas what I'm doing wrong? > > > > > > > > Thanks > > > > > > > > Dan > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Armando Scalise > > > > > > > > > > > > > -- > Armando Scalise > ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/Maptitude/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/Maptitude/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
