I tries to set styles for all objects in my processing_table
, but gets Expression does not evaluate to a column or table name
My code:
'...
pen_style = currentpen() 'get_pen(styles_table_name, obj_type, class_id, selected_scale)
altering_obj = processing_table.obj
alter object altering_obj
info OBJ_INFO_PEN, pen_style
cmd = "select * from processing_table where objectid = " & id_value & " and class_id = " & class_id & " into one_obj"
run command cmd
update one_obj set obj = altering_obj where rowid = 1 ' Expression does not evaluate to a column or table name error
close table one_obj
'...
And sandbox script works perfectly:
'...
query = "select * from " & selected_layer_name & " where " & id_field_name & " = " & filter_value & "into filtered"
run command query
id_field = "filtered.objectid"
while not eot(filtered)
id_value = id_field
altering_obj = filtered.obj
alter object altering_obj
info OBJ_INFO_SYMBOL, point_symbol
query = "select * from " & selected_layer_name & " where objectid = " & id_value & " into one_obj"
run command query
update one_obj set obj = altering_obj where rowid = 1
close table one_obj
fetch next from filtered
wend
close table filtered
'...
I can't understand where these scripts are different. Algorithm is same:
- Alter object from processing table
- Select this object into
one_obj
table - Update it
Both scripts I checked with same tables. May be reason is in different connection to tables?
In sandbox I use already opened table:
selected_layer_name = layerinfo(window_id, suitable_layers(selected_layer), LAYER_INFO_NAME)
query = "select * from " & selected_layer_name & " where " & id_field_name & " = " & filter_value & "into filtered"
And in non-working script I opens table from disk:
cmd = "open table " & chr$(34) & tab_file & chr$(34)
run command cmd
table_name = TableInfo(0, TAB_INFO_NAME)
'...
cmd = "select * from " & table_name & " into processing_table"
run command cmd
cmd
variable each time you build a command string (e.g.Print cmd
) to make sure that they are being created as you expect. Once you're happy that the command strings are fine then you can comment out or delete those print commands.