I need to run a string of code multiple times in a mbx while just changing 2 parameters. I tried a sub and function but both failed. How can I do this.
The code is
Print "Starting DCDB_FeatureName" strFieldName="Feat_Name" strOutTable="DCDB_FeatureName" Create Table "scratch_table" (Search Char(60),X Float,Y Float) file strWorkingFolder+"scratch_table.TAB" TYPE NATIVEX Charset "UTF-16" Locale "en-AU" Create Map For scratch_table CoordSys Earth Projection 8, 116, "m", 147, 0, 0.9996, 500000, 10000000 Bounds (-7745844.29605, 2035.05684549) (8745844.29605, 19997964.9432) Map From scratch_table Set Map Layer 1 Editable On 'Change Group By Create Object As Union From DCDB_Full_Copy Into Table scratch_table Group by strFieldName Data Search=FEAT_NAME,X=X,Y=Y Commit Table scratch_table Interactive 'Check which rows to delete select * from scratch_table where Search = "" into Selection Delete from Selection 'Clean up values and add search type Update scratch_table Set Search = SearchReplace(Search, ",", " ")+" [FeatureName]" DropIndex Auto Commit Table scratch_table Pack Table scratch_table Graphic Data Interactive 'make sure x and y are updated Update scratch_table Set X = CentroidX(obj), Y = CentroidY(obj) 'set order Select * From scratch_table Order By Search Into Sorted Commit Table scratch_table 'set name of table to save data to Commit Table Sorted As strWorkingFolder+strOutTable+".TAB" TYPE NATIVEX Charset "UTF-16" Locale "en-AU" Interactive Close Table scratch_table Interactive Close Table Sorted Interactive
It is just
dim strFieldName as String dim strOutTable as String
That needs to change on each call of this code.