georeference.org
Subscribe to this thread
Home - General / All posts - Fomatting theme from query data
gosens16 post(s)
#23-Oct-08 20:54

Hello, I am a new Manifold user and I've spent a few weeks starting to get up the learning curve. I've been progressing although I have a long way to go before building the application I'm looking to build. In the meantime I am stumped and haven't found the answer in Help or in the forum. I feel that there is likely a simple answer to this, or at least I hope so.

I am looking to format a drawing (or map layer) based on a query that joins the drawing's table to a linked table, but I need to set the field for the area background to be one of the columns in the query. However I can only see the columns native to the drawing when I use the Manifold UI to set the theme.

Do I need a script to do this? Or is there a way to embed the query into the map or drawing in a way that will let me select one of its columns for the purposes of formatting the drawing? I've yet to get into scripting and the object model and I'm a bit daunted about doing so just yet.

In terms of background, here is what I've done:

- I have a drawing with limited data, and more data in a SQL database where I created a view.

- I have linked the SQL view as a table in my project.

- Since I need to relate two fields from the drawing table to two corresponding linked table fields (ie have two key fields), I couldn't do a relation, so I needed a query.

- Now I have a query - and I added a parameter to narrow down the results for each area to a single row. More on the multiple rows thing sometime in the future!

Proud of myself, I can now run the query beside the drawing and, selecting an area in the map, the corresponding row(s) are highlighted in the query results. Yay! But now I'm stumped on how to apply the analysis in the query.

Help greatly appreciated... it will be the first of many questions in all likelihood.

thanks - gosens

tjhb

2,384 post(s)
#24-Oct-08 02:39

Since I need to relate two fields from the drawing table to two corresponding linked table fields (ie have two key fields), I couldn't do a relation

I don't personally know whether this is true (or why it would be), but I'll assume it is since you seem sure.

I need to set the field for the area background to be one of the columns in the query. However I can only see the columns native to the drawing when I use the Manifold UI to set the theme.

Do I need a script to do this? Or is there a way to embed the query into the map or drawing in a way that will let me select one of its columns for the purposes of formatting the drawing?

To be as simple as possible (I think): you need to add columns to your drawing which reflect the corresponding columns in the "related" table. You'll then use those columns for formatting.

Two ways come to mind.

(1) Convert your SELECT query into an UPDATE query, addressing (new) columns in the drawing's table. The disadvantage is having to run the query each time you want to update the formatting.

(2) Use active columns in the drawing's table, instead of a query, to list the "related" values. This can be set to recalculate automatically.

I might be missing the point; this is the sort of question where posting a .map file with some sample data is a really good idea.

gosens16 post(s)
#27-Oct-08 10:15

Thanks tjhb, I think the Active Columns solution will be the way to go, so I will need to ramp up on scripting and on the object model. If anyone can specifically point to examples that involve SQL (and connecting to SQL 2005) in Manifold scripting (VBscript) that would be helpful as I have not found it thus far.

Since I need to relate two fields from the drawing table to two corresponding linked table fields (ie have two key fields), I couldn't do a relation

I don't personally know whether this is true (or why it would be), but I'll assume it is since you seem sure.

If it is possible, I couldn't figure out how. The Relations dialog box can do two relations to separate tables, but not a double key (ie. Table1.Field1=Table2.Field1 AND Table1.Feild2=Table2.Field2).

Thanks - gosens

gosens16 post(s)
#20-Nov-08 12:58

After watching some of the GIS Advisor intro videos - specifically the one on Linked Drawings - I have realized my folly here.

After creating the query that joins the drawing table with the data I need, I needed to:

1) Add the Geom(I) column from the drawing table into the query; and

2) Add a new linked drawing from This Project, and use the query as the item to link. Now it is actually a drawing rather than a query result table.

I was then able to use any of my data columns to set the theme.

0 msec Copyright (C) 2007-2008 Manifold.net. All rights reserved.