M8 also has the Viewbots which I relied on for daily decisions.
Viewbots are cool, for sure. I'm the guy who originally suggested them, so I'd be the last to say they're not useful. :-) But it's easy to use queries to implement the power of Viewbots but in a more general and more powerful way. There's a tradeoff between the very simple interface in 8 and the limitation of power you get with that, and the more difficult but far more powerful analogous capability in 9, but if you want to do simple things you can keep a few projects lying around with snippets that make it easier in 9. There are three ways of doing Viewbot-like things in 9 that first come to mind: 1. Use computed fields. Much of what Viewbots do is to provide per-object computations and readouts, and those can be done with computed fields. If you want the areas of polygons, created a computed field that is powered by the expression GeomArea([Geom], 0). See the Computed Fields topic for many examples. 2. Create labels that include expressions. For example, you can have a computed field called [AREA] that gives the area of a polygon, or you can just create a label for which the text of the label is Area: [[ GeomArea([Geom], 0) ]] where the portion within [[ ]] doubled brackets is an expression. That's a more casual way to generate a readout than creating a computed field and then creating a label from that computed field. 3. Create a drawing from a query where the query does some wonderful SQL that computes the value a Viewbot would. Next, create a label from that drawing and put it in some visible spot in your drawing to report the output of that query. Or, you can just open the label component in its own window and leave it flowing about. An example We have a drawing layer of polygonal areas called Parcels which has a computed field called Area that reports the area for each parcel. We don't really need that computed field but I've included it so that in illustrations each parcel can be labreled with the area, so we can see how the Viewbit (I'll call it that in 9) reports a correct result. We want a readout that shows the largest area of any of the parcels in the drawing. If we change the size of a parcel or add or delete parcels it should update itself. Here's a screenshot that shows my Parcels Drawing with a few other open windows as well: This is what I did to create it: 1. Create a new drawing called marea (for maximum area) and drag and drop it into the Parcels Drawing window as a layer. 2. Create a single point in the marea layer where I want my Largest Area readout to appear. 3. Create a query called mquery that contains the SQL text: -- $manifold$ SELECT [GEOM], (SELECT MAX([PARCELS].[AREA]) FROM [PARCELS]) AS [MAXAREA] FROM [marea Table]; That query (as can be seen in the results table) creates a table with two fields: a Geom field that just contains the geom for the single point in the marea drawing, and an aliased field called [MAXAREA] that contains the single value that results from the SQL statement SELECT MAX([PARCELS].[AREA]) FROM [PARCELS] Note that when we put together a field like this for a table we can use a SELECT statement, but if we were to create a computed field within a table we cannot use a SELECT (I don't think...) but have to use a simpler expression. 4. Create a drawing from the mquery query. The geom that comes in from the marea drawing is in Pseudo Mercator (I created the marea drawing using default settings) so that's what we use for the drawing. To learn all about creating drawings from queries, see the Example: Create a Drawing from a Query topic. 5. I added the drawing created from the query, called mquery Drawing, as a layer to the Parcels Drawing window just to make sure it did, indeed, create a point at the desired spot, but that's not necessary. 6. Create a new Labels component called Maximum Area from the mquery Drawing. The text for that label is Largest Area: [MAXAREA] When you add the Maximum Area labels component to the Parcels Drawing window, it reports the value for the MAXAREA aliased field from the drawing created by the query. 7. If you change the size of the polygons or otherwise modify them, the Largest Area readout updates: If it is inconvenient to have to pick a spot for your readouts in your main map that will always be in view, you can just open the Map window in a second window, undock that window and just park it somewhere on your Windows desktop in view. That will allow you to put your "viewbit" readouts in a part of the map far away from your working space, and to zoom the second window into just those portions. The above technique, creating a field in a query which is generated from a SELECT that is later reported in a label is a very useful and powerful technique. Because SELECT statements can be very, very extensive and powerful, they allow you to do all sorts of things that cannot be done with Viewbots. Read the topic on creating drawings from queries to learn how to do things like reckon only those objects that are selected, so you can use this technique to create viewbits that report results only for, say, selected objects. The possibilities are pretty much endless, so long as the result of that SELECT is a single number which can then sensibly be reported in a readout. But that's the same limitation you get with Viewbots so overall you get more power. Attachments: viewbits_01.png viewbits_02.png
|