One request that has come up a few times has to do with the use-case of performing a trace and generating a report from the results. For example, this capability would be used to generate mail-merge letters for clients affected by a planned outage.
There are a couple of ways of doing this, both involving a little programming. One way is to generate a Report PlugIn that performs the trace to generate an in memory table against which the report would be run. Unfortunately, this would mean writing a plugin for each trace type required, effectively requiring a re-writing or encapsulation of the existing trace workflow. Another way, and the topic of this post, is to capture the trace results from any trace to a table in Oracle that the report can be run against.
To make the table idea work correctly in the face of a multi-user environment, the trace results would need to be written to a different table for each user, or the table would need user specific fields for each record, or we could take advantage of a cool Oracle capability - a temporary table. A global temporary table is permanent, but the data in it is maintained only for the session, and visible only to the session. This means, each user sees only their own data and the data is erased when the session is disconnected. Perfect.
Even though the full feature data is available in the trace results, it is sufficient to save only the feature ID and the feature class ID in each result row. The report can then retrieve what it needs to write the report - it might not need or want all traced features for example. So, the temporary table creation SQL is:
create global temporary table trace_results
(fid number(10,0), f_class_id number(10,0))
on commit preserve rows
which of course only needs to be done once per document.
The real trick is to somehow get hold of the trace results. Start with a DocumentPlugIn
and set up a button on the Main Toolbar for the user to press when they want to copy the trace results to the trace_results table. When the button is pressed, access the WorkflowUserPanelDesktop
by cycling through the controls in the WorkflowExplorerDesktopFlyIn
. From there, access the GeneralWorkflowContainerDesktop
that has the trace results in the NetworkTraceResultFeatureExplorerData
object in its DataList. It's OK, you probably don't have to understand.
This NetworkTraceResultFeatureExplorerData
is the one that has the result features, unfortunately they are inaccessible, since there is no public accessor for them. But, by using reflection the value of the field holding the result list can be obtained. Given the list of features, it's a simple matter to insert the FID and FeatureClass.ID of each element in the list. The supplied code uses array inserts in case there are a lot of features. The Topobase Administrator Report Designer can now be used to create a report that accesses the records in the table.
To use the program, copy the TraceGrabber.dll and TraceGrabber.tbp file to the Topobase Client bin directory. Start Topobase Client and generate graphics. Expose the Main Toolbar by right clicking on the document in the Topobase Explorer and choosing it from the Toolbars submenu of the context menu.
Perform the desired trace, e.g. Find Connected, from the Workflow Explorer. Click on the Trace Grabber buttton. The trace results will be copied to the TRACE_RESULTS table. Use the Report Designer to create your report based on the TRACE_RESULTS table. It's a bit disconcerting because the Topobase Administrator will be using a different session connection and therefore can't see the results, but when the client runs the report it will work.
Of course, source code is supplied, so you can add code that automatically spawns the report when the button is pressed, avoiding the two step process of pressing the button and then running the report. A silly little default report is also included as an example.
AUTODESK DOES NOT GUARANTEE THAT YOU WILL BE ABLE TO SUCCESSFULLY DOWNLOAD OR IMPLEMENT ANY SAMPLE CODE. SAMPLE CODE IS SUBJECT TO CHANGE WITHOUT NOTICE TO YOU.
AUTODESK PROVIDES SAMPLE CODE "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. IN NO EVENT SHALL AUTODESK OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS
OF DATA, OR LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, THAT MAY OCCUR AS A RESULT OF IMPLEMENTING OR USING ANY SAMPLE CODE, EVEN IF AUTODESK OR ITS SUPPLIERS
HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Download TraceGrabber for Topobase 2011
hi. noticed you have a "Download TraceGrabber for Topobase 2011" . has 2011 been released yet?
Posted by: frank bowne | March 10, 2010 at 06:31 AM
Topobase 2011 is currently in Beta.
Posted by: Derrick Oswald | March 10, 2010 at 07:25 AM
This is a very useful tool. We have used the TraceGrabber successfully to make reports based on the trace results. We report on the customers, transformers and conductor types based on trace results.
Posted by: Steve Braddock | December 06, 2011 at 10:15 AM