Zum Hauptinhalt gehen

Basic question about report (rpx) scripting

Kommentare

6 Kommentare

  • Permanently deleted user

    Anyone?

     

    Does Latitude have any info on how to do this? 

    Peter.

    0
  • Permanently deleted user

    Peter,

    Geocortex Reporting is based upon .net Active Reports (see http://www.datadynamics.com/products/ActiveReports/Overview.aspx). 

    You may wish to take a look here as there is some documentation around scripting i recall but its not specific to the geocortex obviously.  

    I have some generic scripting that gets some sessionID's for purpose of printing user name etc from ADF client (see my other posts as i currently have an outstanding request seeking more info for migrating it for use by Silverlight Viewer).

    You are correct there is little or no documentation from Latitude when it comes to scripting for reports.

    Brad

     

     

    0
  • Permanently deleted user

    FYI - ArcGIS 10 is reporting is also now based around active reports so what you learn here can be transferred although @ 10 its very limited model.  This is being opened up more in 10.1 release.

     

    Brad
    0
  • Permanently deleted user

    Peter (and Brad),

    I'll mention also that if you look at the Active Reports documentation for information on scripting, you should follow the link to the Active Reports Version 3 documentation, not the Version 6 documentation.  They're similar, but slightly different and we're using the Version 3 libraries.

    Most of the scripting examples are relevant, but it will be likely very helpful to understand in detail how the data gets supplied to the report itself, to better understand the data structures you're working with in script.  I've written up some documentation that will make it into a future version of Report Designer on this topic, which I'll paste here for immediate consumption:

    *******

     

    When Geocortex Essentials generates a report, it takes the preconfigured template, the dynamic data from the map, and mashes them together. Understanding how this process occurs is useful both when creating custom functionality in an Essentials as well as when configuring layer and print template reports using the out-of-the-box tools.   A Geocortex Essentials template report can accept data in one of two main formats - a DataSet and a DataTable. A DataTable is analogous to a single database table or a single Excel worksheet. A DataSet is a collection of DataTables; as such it is analogous to a multi-table database or a multi-worksheet Excel workbook. The actual data to be included in the report is contained inside a DataTable - when a report needs to display data from only a single source (from a single spatial layer, for example), a single DataTable is sufficient. When a report needs to bring together data from multiple different data sources, each with their own combination of attributes, then a DataSet is needed to collect all of the different DataTables together.   Any type of data source that a report can contain - spatial data, linked external data, or map data - needs to be pushed into a DataTable format. In the case of spatial data and linked external data this is easy to visualize. In the DataTable, each separate record (or feature) is represented by a single row in the table, with each attribute representing a single column. So, when a property report is generated in Geocortex Essentials from a selection of 5 parcels, a DataTable with 5 rows is constructed where each row represents a single parcel. If the property report also needs to include owner information retrieved from an external Oracle database, another DataTable is constructed with each row representing a single property owner - this may result in more than 5 records if there can be multiple owners for each property (a one-to-many relationship).    In the case of map data where a report must display images representing the main map, scale bar and other map elements, Geocortex Essentials constructs a DataTable with a single row and multiple columns. Each column represents a different component of the map; for example, the main map image, the north arrow, scalebar, overview map, etc. Into each of the columns in this DataTable, Geocortex Essentials inserts the raw data representing the map. For images this is the binary image data representing the JPG, PNG or other image format. For text (such as the map's current scale) content, it is the raw text which is inserted into the column.   In addition to this single-column DataTable created for the map data, another DataTable is created by Geocortex Essentials to represent the map legend. In this DataTable, each separate symbol for each layer is stored in a single row. Layers which are drawn with a single symbol have a single row in the database. Layers drawn with multiple symbols (using unique values or classified symbology) have multiple rows in the database - one row for each unique symbol and another one for just the layer name itself. If you look at a legend as drawn in one of the default print templates, each distinct line corresponds to a row in the legend DataTable.   Geocortex Essentials collects all of the relevant DataTables required for the report and stores them into a single DataSet, which it provides to the report template. Since a single report template can only display data from a single source (or DataTable), in order to create a report which shows all of the data in the DataSet, a separate subreport must be used for each separate DataTable. When running the report, Geocortex Essentials finds each subreport in the template and assigns the correct DataTable to it - the linked data containing the owner information gets passed to the owner subreport, the map image data gets passed to the map subreport, and so on.    The mechanism by which Geocortex Essentials knows which DataTable to pass to each subreport is by inspecting the ReportName property of the subreport control itself. Geocortex Essentials assigns a unique name to each DataTable in the DataSet which is supplies to the report. The name given to the DataTable depends on what data is being represented. Externally linked data gets stored in a DataTable with a name equal to the ID of the data link that is configured in the site. Map data is stored in a DataTable named MapSubReport. Legend data is stored in a DataTable called _Legend. When a subreport is configured, ensuring the ReportName property matches the correct DataTable name will ensure that the correct data is passed into the subreport.   The main (parent) report template is assigned the first DataTable found in the DataSet (at index zero) - Geocortex Essentials does not use a name to determine which DataTable to use. While this is transparent for most interactions with reporting in Geocortex Essentials, it is necessary information if you want to do any custom reporting.   Understanding this process will help greatly if you need to run a report based on dynamic, arbitrary data which has been collected in custom code or inside a custom workflow. The Geocortex Workflow activity called TemplateReport can accept any DataSet which you construct. Since you are in charge of constructing this DataSet rather than Geocortex Essentials, you need to make sure you give your DataTables names which match the corresponding subreport's ReportName property in the main report template.   John
    0
  • Permanently deleted user

    Thanks John,

    This definitely helps to understand the structure and process that Essentials follows when generating a report.  Thanks also for clarifying the documentation version to look at.

     

    If you have specific examples of how to navigate the dataset / tables, I would really like to see them.  After a lot of trial and error, I finally found an example that I could get to work - one of the stumbling blocks for me was the fact you have to cast and ARControl objects to a specific type in order for it to be recognized.

     

     

    For example, to read / write a label on the map you have to do something like:

    publicvoid detail_BeforePrint()<p> </p> {<p> </p> if(((DataDynamics.ActiveReports.Label) rpt.Sections["detail"].Controls["_Title"]).Text=="MyMap")<p> </p> ((DataDynamics.ActiveReports.Label) rpt.Sections["detail"].Controls["_Title"]).Text="YourMap";<p> </p> }

    This accesses the objects in the report layout and the data assigned to them, but is it possible to access the DataSet/Tables passed into the report?  If so, does it need to be done in ReportStart or DataInitialize methods?

    Thanks,

     

    Peter.
    0
  • Permanently deleted user
    Hi Roger, did you figure out how to assemble a DataTable for the north arrow? I'm also trying to figure out how to do it for the Legend.
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.