cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal 2008 reading TextObject from VB.NET 2005

Former Member
0 Kudos

Hi there,

I have been tasked with rewriting the crystal compiling software for the company i work for.

The previous version was written in VB6 and used an pretty old version of Crystal.

We now use Crystal 2008 and VB.NET 2005.

I have overcome many hurdles and we have implemented the software with success, however there is one final issue that I am struggling with..

When 'compiling' a report for say email dispatching, the previous software would read the value of a ReportObjectKind.TextObject off of the report where its name is 'EmailSibject' and set the subject of the email to that.

The problem im having is because the textobject is dynamic, when I read the value in i get {DATA.DATA_UID} - this is the database field not the value of it that I am after.

The code I am using is as follows:

{

Do

Dim ReportSectionss As CrystalDecisions.CrystalReports.Engine.Sections = CRReport.ReportDefinition.Sections

For Each CurSection As CrystalDecisions.CrystalReports.Engine.Section In ReportSectionss

For Each RepObj As CrystalDecisions.CrystalReports.Engine.ReportObject In CurSection.ReportObjects

If RepObj.Kind = ReportObjectKind.TextObject Then

Select Case RepObj.Name.ToUpper

Case "EMAILSUBJECT"

EmailSubject = CType(RepObj, CrystalDecisions.CrystalReports.Engine.TextObject).Text

Exit Do

End Select

End If

Next

Next

Exit Do

Loop

}

How would I go about getting the value that is actually displayed of the report?

Thanks

Dave

Edited by: Davec_123 on May 23, 2011 12:59 PM

Accepted Solutions (1)

Accepted Solutions (1)

former_member208657
Active Contributor
0 Kudos

The quick answer is - you can't. The info you are looking for was availble in previous SDK's through section formatting events. What you are looking at is the report definition of the TextObject. In this case it is pulling the data from a database field. The Crystal Reports .NET SDK doesn't allow access to the results of the report.

In this case you'll need to choose something more generic for your email title and not get it dynamically from the report results.

Former Member
0 Kudos

Hi David, Thanks for your reply.

when you say "get it dynamically from the report results." what do you mean?

I'm sorry if this sounds a silly question, Ive not successfully read any report results as of yet so a hint in the right direction would be brilliant.

They arent bothered how I get the email subject info, and are happy if I request a change to how the reports are constructed.

i.e. read in a hidden (or visible if thats the only option) value from some other object.

Thanks again

Dave

former_member208657
Active Contributor
0 Kudos

There is a difference between the report definition and the results you see when you run the report. What you are seeing is the {TableName.FieldName} as we've defined it in the report. When inspecting the value as you've done you just get to see where we get the data from.

The problem is getting the right data from the database. For example, if this report object you've found in your code is in the details or page header - how are we to know which page and which row of data we are getting the data from? If there are 750 results and 30 pages, which is the correct value?

In the past we used section formatting events to do this, but that isn't included now with Crystal Reports .NET. It was also quite a bit of code to get this one piece of info out.

You could do some work with the RAS Inproc SDK and use the RowsetController to browse some of the raw data that comes back in your report. Search for RowsetController in the knowledge base and you might get a few hints on how to do this.

Former Member
0 Kudos

Thankyou, thats given me plenty to think about for the time being.

Dave

Answers (0)