Subscribe to this thread
Home - General / All posts - M9 schema-expression suggestion.
geozap
264 post(s)
#28-Sep-18 11:16

In viewer 9 I wanted to create a Computed field with the area of some Areas. Reading the help topic "Example: Add a Computed Field to a Table" I found that I had to use the GeomArea([Geom], 0) expression. Also I found also that if I want a column with the X of some points I have to use VectorValue(GeomCoordXY([Geom], 0),0) and that for line length I would use GeomLength.

I think there is the issue here that since none of these expressions are obvious, the user has to search for them and more important maybe it takes a lot of writing to get something so trivial such as a point's X coordinate. Wouldn't it be useful to have some kind of list with shortcuts next to the Schema-Expression field for the most usual functions, such as length, X ,Y, area, or with the last ones used?

KlausDE

6,410 post(s)
#28-Sep-18 14:27

I'd test the function to compute the field with an ordinary query and have all the tools and (future) error messages at hand. Then copy/paste the check SQL syntax.


Do you really want to ruin economy only to save the planet?

dchall8
1,008 post(s)
#28-Sep-18 15:32

You could make the same argument in M8. I followed Dr Lembo's video tutorial 10 years ago and have been using the following active column script ever since.

Function CalcArea

    CalcArea = Record.Data ("Area (I)") /43560

End Function

I agree that you have to have know what you're looking for before you start.  Reading the manual, as you did, is way to find that out. 

geozap
264 post(s)
#28-Sep-18 16:20

M8 has intrinsic fields and you just have to make their column visible in tables and you have X,Y, etc.. In M9 I don't think they exist (or do they?) and I would like to easily get columns with basic entities properties

tjhb
10,094 post(s)
#28-Sep-18 17:22

What do you expect to be obvious, before you have learnt it? (Agreeing with dchall8.)

This is not about intrinsic fields (you're right, they don't exist in 9), but about function names, isn't it?

Anyway, in 9, all field names are shown in the Schema dialog where you make an expression, and also in the table which may well be underneath. Or if you are making the computed field in an SQL command window, then all fields can be shown in the tables panel with just one drag from the Project pane.

But getting back to functions. Their names are more "obvious" in 9 than in 8--once you have learned and practised a bit--for 3 reasons. First, naming is systematic. If it is a geometry function, it starts with Geom; an image function starts with Tile; a text function starts with String, and so on. Secondly, expressions are just SQL. you learn a new piece of SQL9 syntax once, you can use it everywhere. Same functions, same syntax. Third, there is a query builder, with a comprehensive list of all the syntax you need for queries, right in the UI. Just press Ctrl-~. Similarly for the Expression tab for Contents > Transform. In both cases you can just double click, hardly any typing required. ...

Could something similar be added for the Schema dialog, to give a handy reference when writing the expression for a computed field? That could make a good suggestion, especially at the moment since Adam has mentioned there are already plans for a redesign of the Schema dialog.

Dimitri


7,413 post(s)
#28-Sep-18 18:43

I keep fragments of frequently-used SQL in a .map project. Same with image servers and so on. I'll usually have two or three Manifold sessions running, one of which is a "service" session that has one of those projects open in it, so I can copy/paste into the project that I'm using. It's amazing how much you can copy/paste from one project into another.

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.