Subscribe to this thread
Home - General / All posts - Creating template drawing/table with active columns
Sev
411 post(s)
#03-Apr-19 03:46

Hi everyone, I have a question regarding transferring the active column to a new drawing.

What I'm trying to do is this.

  • Create a drawing, with the associated table having a couple of active columns.
  • I wanted to copy this drawing and paste as a new drawing numerous times for a number of clients, retaining the active columns. This doesn't seem to be possible?
  • The first active column needs to be named OBJECTID, and simply needs to be a unique number for the object, so I was simply copying the ID across to this field.
  • The second active column was to divide the length (m) by 1000, to get the result in km.

If what I'm attempting is not possible, is there another approach I could take? Would I need to have a new .map project for every client?

Thanks in advance. Manifold 8.0 Universal Ed....

Sev
411 post(s)
#03-Apr-19 03:54

Edited original post.

tjhb

8,657 post(s)
online
#03-Apr-19 04:00

I wanted to copy this drawing and paste as a new drawing numerous times for a number of clients, retaining the active columns.

(1) What should be different for the different clients? If nothing, why copy and paste?

(2) Why do you want to retain the active columns? Are the clients all using Manifold 8?

There is something important that you are not saying.

Sev
411 post(s)
#03-Apr-19 04:26

Hi Tim, each client will have a different drawing of their property, the table behind their drawing needs to be in a specific format.

My idea was to create a blank drawing, modify the associated table to exactly how it should look, then copy/paste as drawing/rename to each client and create the objects in the newly created drawing.........

I guess the alternative would be to create the objects in the template, then copy/paste to new drawing, then delete the object in the template and start again.....

The drawings will be exported (.shp) to each client.

I hope this makes sense.

Andrew.

tjhb

8,657 post(s)
online
#03-Apr-19 04:42

But export to shapefile will not retain any formatting. None whatsoever.

By "format" what do you mean?

My gut feeling is that you need SQL. Whose usefulness depends on being able to specify exactly what you need.

Sev
411 post(s)
#03-Apr-19 05:33

Sorry, I'm probably using incorrect terminology, making things more difficult.

I'll post a snip of what is required for each drawing...

So the OBJECTID just needs to be unique, hence the copying of the ID field

Attachments:
Capture.PNG

oeaulong

186 post(s)
#03-Apr-19 16:02

Do you have all the Activities in one drawing?

Are Client associations in this drawing or related table?

When you speak of Active Columns this has a definite meaning in Mfd8. A Computed Column in Mfd9. These used a script for Mfd8 where Mfd9 uses a SQL expression.

This can all be accomplished with queries in both versions of Mfd. Tim's advocacy for SQL reflects his oceanic knowledge on the subject.

Assuming all of your drawing objects are in the same larger storage Table/Drawing.. I envision a few SQL queries that dump the Client's data to a table with the changes made to field names such as OBJECTID. The calculations such as kilometer conversion could be made here. Then a Drawing linked to this table using the Geom field. This would get refreshed when you need to export another Clients .shp file. The exporting process could be further automated with a script that refreshed the queries & drawing and then processed this to a clients file system directory for compression and delivery.

Dimitri


5,359 post(s)
#03-Apr-19 16:27

These used a script for Mfd8 where Mfd9 uses a SQL expression.

What you write is true and exactly correct. Just wanted to add that you can call functions written in scripting language from SQL, so in 9 you get both. The new Expression and Expression Context capabilities in the new Schema dialog are massive, far beyond what was in 9 before, and just a whole new universe compared to 8.

In a nutshell, the Expression Context tab is where you can put whatever you want to do to set the context: include other queries, define VALUE constants, define functions and so on, and then you can use that context within the expression. So you could define elaborate functions within a query that's included in the Context tab, and then use those functions in shorter, more legible expressions in the Expressions tab.

If you launch the expressions builder using the Edit Expression button you can see the very long list of template capabilities for the Expression Context tab, plus a somewhat shorter list for the Expression tab.

oeaulong

186 post(s)
#03-Apr-19 17:16

Dimitri, thank you for the elaboration. There was a lot of people in the days of v.7&8 that were working to build and call queries from scripting code. Full circle with the functions now available from the queries and expression scope. I am still trying to catch up on the flexibility for creative uses of where Mfd exist currently and near future.

vincent

1,767 post(s)
#03-Apr-19 17:17

A few lines of code to duplicate, 2 Update SQL queries, and another few lines to run the 2 queries across all copies would do the job I think. This way, you are easily replacing the Active columns by SQL.

Sev
411 post(s)
#04-Apr-19 01:36

Thanks everyone for the assistance, unfortunately I'm not capable of the simplest of queries to achieve what is required, although it's something I'd love to be capable of....

I think I'll change my approach, and use the template to create the object, so the active columns do their thing, then copy the object to a new drawing and rename. This will achieve the desired result I think.

I did notice the columns changed position when copied to a new drawing, is this able to be avoided?

Thanks again, Andrew.

Dimitri


5,359 post(s)
#04-Apr-19 08:25

I'm not capable of the simplest of queries to achieve what is required, although it's something I'd love to be capable of....

Well, then, now is the time to become capable of that! It's far easier than people think.

Using simple SQL, as seems would be plenty for this example, in particular is very easy to learn. What is nice about SQL is that in the first ten minutes of reading the very first chapter of "how to work it" in, say, one of Chris Fehily's fine books on SQL, you can be instantly, confidently productive. It's that easy.

Don't over-think it. Just get started doing it. Even if you only spend 15 minutes a day reading a few pages at a time, you'll get very productive very quickly.

As a learning environment, I recommend 9 over 8. You can download the free Viewer and do SQL to your heart's content. Download the books projects from the product downloads page for 9 (or Viewer) so you can follow along in the Fehily books without having to keyboard all of the many examples.

Viewer is read only, so you can't save a project if you create your own wonderfully cool and intricate queries. But what you can do is copy the text of the query and save it into an ordinary text file in Windows, say, using Notepad. The next time you fire up Viewer you copy the text and paste it back. Or, you can just have multiple Viewer sessions running and leave one open all the time to use as a scratch pad for copying and pasting back and forth. I never turn my systems off so that works for me.

Trust me on this: SQL makes so much stuff so easy and quick when working with data, and SQL is so easy to pick up for simple uses, that the slight effort required to get going with SQL will pay you back a zillion times in time saved and enhanced capabilities.

Sev
411 post(s)
#04-Apr-19 13:37

Thanks for the vote of confidence Dimitri.....I'm doing a bit of stuff with arduino and LoRa atm also, and the sketches I see as a little bit like this sql, looks crazy hard at first, but once you work you way through it it starts to make a bit of sense.

I'll have a look at the link you provided and have a go.

Much appreciated and as usual, this community is really helpful.

Andrew.

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