Subscribe to this thread
Home - General / All posts - selection M9 - selection (I) M8
yves61
234 post(s)
#26-Feb-21 16:35

M8 offered the possibilty - by means of SQL coding - to "select" (not just filter) objects in drawings and table records ( --> Selection (I)) = TRUE).

I have not find yet the same possibility with M9 . Objects in M9 can be "selected" by clicking interactively in the window, but - unless I am mistaken - cannot be selected programmatically as within M8.

Am I overlooking a (SQL) solution in M9 to do so?

Sloots

508 post(s)
#26-Feb-21 17:44

SELECT * FROM CALL Selection([Drawing Table]TRUE);#


http://www.mppng.nl/manifold/pointlabeler

tjhb

9,627 post(s)
#26-Feb-21 22:15

Well, let’s read the question.

The answer is no. You can’t set the selection in 9 by code.

yves61
234 post(s)
#26-Feb-21 22:59

I found some older threads on the same topic.

http://www.georeference.org/forum/t148642.2#148643 Volker

http://www.georeference.org/forum/t147034.12#147076 by Adam

http://www.georeference.org/forum/t141310.25#141311 by ArtLembo

So apparently , in M9, it cannot be done in order to "highlight" selected/filtered records or objects directly.

But through the "select pane" it can be done but then again interactively by clicking the "select" button,

But clicking the "edit query" button in the "select pane" and running the query from the command window pane, will eventually not "highlight" the objects but just run a select sql query.

So M9 has somewhere code to "highlight" objects by means of interactively select the objects in the window or click the "select" button in the "select pane". Could this functionality be implemented in M9 programmatically / automated in order to be used also in sql query syntax ? If so how ?

Dimitri


6,511 post(s)
#27-Feb-21 04:35

The express point of interactive selection is to indicate what is done by hand, differentiating such interactive "selection" from picking out subsets done programmatically, such as by using SQL or programming. When you have the possibility of zillions of background processes in action, it is essential to provide unambiguous means for people to see and know what they themselves did by mouse and keyboard.

I suppose one reason there isn't a function is that could be misleading, as the result would not be done by hand. Another reason could well be that if you want to pick out subsets of records programmatically, there is a huge apparatus in place to do that. It could be that there is a way to do that given what your ultimate objective is.

Why do you want to mimic interactive selection through programmatic means?

yves61
234 post(s)
#27-Feb-21 07:33

Just, merely to have the result of a query be visually "highlighted" on screen, not needing to make a result TABLE, then select ALL the objects (records) of this table, to see the result visually on screen .

tjhb

9,627 post(s)
#27-Feb-21 07:58

Yes, the importance of this (missing) feature cannot be overstated.

To show a user the result of a query, with user-defined parameters--invaluable.

I don't know what Dimitri can be thinking. The express point my maiden aunt.

Dimitri


6,511 post(s)
#27-Feb-21 12:20

I don't know what Dimitri can be thinking.

? I'm thinking the power of SQL, of course, and the right way to harness it within 9.

To show a user the result of a query, with user-defined parameters--invaluable.

Those are two different things: 1) to have the result of a query be visually "highlighted" on screen, and 2) to enable user-defined parameters.

Want to see the result of a query highlighted in a map? Easy: create a drawing from the query. There's an example topic that shows how to do that.

Reserving the difference between interactive picking of objects and selection via SQL is a very big deal. It prevents confusion when mixing interactive work with programmatic work.

Consider the Mexico drawing and table used in the above example topic link. Write a query:

SELECT * FROM [Mexico Table] where Population > 2001187;

and create a drawing from that query. Drop that drawing into your map. You can now do interactive selection on that drawing-created-from-a-query with the mouse, such as ctrl-clicking a province to select it. With the focus on that layer in the map, you can even use the Select pane, for example, to Search for records where Automobiles are greater (>) than 200000. Press Preview and you get a preview. Change the action and you can modify the selection.

But you can also do different manual picking ("selection") in a query results window or in a window where the drawing based on the query is in its own window and not in a map, and likewise use the Select pane to construct different picked ("selection") sets. All that can get complicated quickly. Visual distinctions between hand picking ("selection") and what's going on in SQL is useful to keep the different techniques clear.

yves61
234 post(s)
#27-Feb-21 15:09

Dimitri,

Thanks for reminding me of the example "create a drawing from a query".

I will dig into it, to see what possibilities this opens, and not forgetting to use CTRL-F5 to refresh.

joebocop
454 post(s)
#01-Mar-21 20:35

Here's how I do it, which mostly works, so long as the list of selected features isn't "too long".

You write your query to return results including a field that has a BTREE index on it. You wrap that query with another query that produces a single text string like

SELECT 

  '[btree_field] IN (' & StringJoinTokens([btree_field],',') & ')'

FROM (

  -- Your query goes in here

     )

Copy the contents of the single cell returned by that query, and paste them into the SELECT pane's "Expression" text box with your desired drawing/table focused. Click 'Select' and that ought to do it. Of course, if your text string is too long, it will be truncated by the Expression text box, and none of this will be useful to you. Sorry.

yves61
234 post(s)
#01-Mar-21 21:06

Joebocop.

Thank you for this example . I will try this out and let you know.

yves61
234 post(s)
#04-Mar-21 09:41

@joebocop : In the meantime I found this working for my initial purpose

http://www.georeference.org/forum/t155243.17#155352

However the above is not the answer to this initial thread to "highlight" sql selected /objects in drawings

Nonetheless thanks for your suggestion.

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