As well as selecting, deselecting and deleting objects, it is possible to use SQL to set values for fields in objects in the InfoAsset Manager networks. If you wish to set values for fields for objects in the default table, this may be done with the SET keyword.
It is possible but not necessary to have a WHERE sub-clause. As with selection, deselection and deletion, values will either be set for all objects or only for selected objects depending on the setting of the check-box.
If you do not have a WHERE sub-clause then the assignment will be done for all objects or all selected objects, otherwise it will only be performed for the objects for which the WHERE sub-clause is true.
It is possible to perform more than one assignment at once by separating them with commas.
Examples:
SET user_number_1 = 123
SET user_number_2 = user_number_1 / width
SET user_number_1 = 123 WHERE x > 10000 AND y > 12000
SET user_number_1 = x, user_number_2 = y
SET user_text_1 = 'XXX'+node_id, user_text_2 = asset_id WHERE width > 200
When you have more than one assignment in a clause separated by commas they are performed from left to right, so it is safe to assume that the value of a field in one assignment will be the value that it would be after performing the previous assignments in that clause.
It is possible to override the default table and the default selection behaviour. In both cases this is achieved by using the UPDATE keyword.
To override the default table, the clause should begin with UPDATE followed by the table name followed by the keyword SET and the rest of the clause as above e.g.
UPDATE [All Links] SET asset_id = ''
UPDATE [All Links] SET asset_id = '', user_number_1 = 0.0 WHERE width > 200
To override the default selection behaviour, begin the clause with UPDATE ALL or UPDATE SELECTED as appropriate.
To override both these two mechanisms should be combined e.g.
UPDATE SELECTED Node SET user_number_1 = 123.45
It is possible to set fields to the NULL value described above e.g.
SET ground_level = NULL