Quantcast
Channel: SCN : Unanswered Discussions - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 2556

Is it possible to update Datastructure definition programmatically?

$
0
0

Hello,

 

I would like to add new database fields to the Database (DatabaseController) model, so that i can link them.

>I'm talking about the data definition of the report. I do not need to put database fields to the visual report.<

 

The aim is to bend existing Tablelinks to new fields, as underlying database structure has changed,

that affects the reports.

 

I'm using VS2013, and CR for VS v.13.0.11.1467.

 

Here is a bit of code of what I'm trying to do...

 

private void AddMissingFields(CrystalDecisions.CrystalReports.Engine.ReportDocument Report)        {            // local vars                       CrystalDecisions.ReportAppServer.DataDefModel.Table ATable = null;            //CrystalDecisions.ReportAppServer.DataDefModel.Field AField = null;            FieldObject AField = null;                       // get report object from session or create a new report object            CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument ReportClientDocument = Report.ReportClientDocument;            CrystalDecisions.ReportAppServer.Controllers.DatabaseController dbController = ReportClientDocument.DatabaseController;            ATable = (CrystalDecisions.ReportAppServer.DataDefModel.Table)dbController.Database.Tables.FindTableByAlias("SchuelerZeitraeume");            if (ATable != null)            {                // create field object                AField = new FieldObject();   <-- HAS NO CONSTRUCTOR, ALSO ...DataFedModel.Field                // fill field properties            }        }

The Problem is, that i can not find a possibility to create an field object. The Field Classes don't seem have an constructor or an method

that delivers me a new field object.

 

 

Here's an abstract example of two tables and what i want to achieve in it's linking in the reports.

 

(---> marks the linking)

 

Prechange datastructure, how it is now:

 

Table Left               Table Right

--------------               ----------------

FieldX        --->       FieldX

FieldY       --->        FieldY

FieldZ        --->       FieldZ

 

 

Postchange datastructure, how it should be then:

 

TableLeft               TableRight

--------------               ----------------

ID               --->     ID_OF_TableLeft

FieldX                   FieldX

FieldY                   FieldY

FieldZ                   FieldZ

 

1. New Fields ID and ID_OF_TableLeft in TableLeft and TableRight

2. Removing the Linking of the Fields X, Y and Z

3. Adding new Tablelink on the IDs

 

 

Thanks and regards

Antonio Cambule


Viewing all articles
Browse latest Browse all 2556

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>