Skip to Content
author's profile photo Former Member
Former Member

The report field type is not valid Exception trying to add a FieldObject (RAS)

Hello,

I'm trying to add a database field to a Crystal Report using RAS SDK, but when the field is being added to the ReportObjectController an exception is raised:

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in ...

Additional information: The report field type is not valid.

This is the code used to create and add the field:

Dim fldObj As CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject

fldObj = New CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject()

fldObj.DataSourceName = rsFields("TableName") & "_" & rsFields("FieldName")

fldObj.Left = rsFields("FieldLeft")

fldObj.Top = rsFields("FieldSectionTop")

fldObj.Name = rsFields("FieldName")

fldObj.FieldValueType = CrystalDecisions.ReportAppServer.DataDefModel.CrFieldValueTypeEnum.crFieldValueTypeStringField

pRpt.ReportClientDocument.ReportDefController.ReportObjectController.Add(fldObj, crSection, -1) 'Exception is raised

I have checked that DataSourceName is in the data source and the data definition of the report.

Can anyone help me with this?

Thanks in advance

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Aug 05, 2016 at 01:27 PM

    Hi Gonzalo,

    What SDK are you using and is it the latest?

    If you create a report using CR Designer and add that field does it work and how is it reported?

    Does it fail on all string fields or just this one?

    Don

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.