Assuming you have a drawing with some objects called [Drawing]
- Open a View->New Command Window->SQL. It opens in Query Builder mode.
- Drag [Drawing from the Project pane into the empty area down left. The structure of the table is shown.
- Type SELECT in the filter box above the SQL phrases at the right side.
- Double click the SELECT ... line and the basic syntax is copied into the command window.
- Select the <table> substitute by doubleclick and replace it with a doubleclick on [Drawing].
- Select the fields list between SELECT and FROM and in the Filter for SQL phrases search for functions that work with geoms. So filter for 'Geom'. You can get closer as you want to get the Coordinates in the Geom. So set the Filter to 'GeomCoord'. Now what you need is easy to find:
- Doubleclick 'GeomCoordXY(..)' and it replaces the selected fields list.
Not that 'GeomCoordXY()' returns a valuex2, a 2-dimensional point.
- In the command Window select <geom> and as you already guess replace it with [Geom] of your [Drawing] with doubleclick.
- <coord> is the index of the coordinate in the object. For points it's 0.
- Run the query for a test, It returns [x, y] pairs of coordinates. I.e. a vector of 2 values.
- Click the Query builder tab to return tu the list of SQL phrases and filter for 'Vector'
- In the list you see a function VectorValues(<valueNx>, <index>) that returns a value
- Set the cursor in front of GeomCoordXY(... an insert VectorValues template with doubleclick.
- Of course GeomCoordXY() returns your <vectorNx> and the index of x is 0. So you shuffle the command to read
- ... VectorValue(GeomCoordXY([Geom], 0), 0) ...
SQL is really easy to learn this way.
To wrap this in an UPDATE and SET values in another field use the Query Builder again.
( SELECT [mfd_id],
VectorValue(GeomCoordXY([Geom], 0), 0),
SET [x] = [result];
Update needs a unique identifier to work. That's why [mfd_id] comes in.
Shutdown adjusts priorities: Do we really want to go back to where we came from?