1933325 - How to "Enforce Join" link using the Crystal Reports SDK for Visual Studio .NET

SAP Knowledge Base Article - Public

1933325 - How to "Enforce Join" link using the Crystal Reports SDK for Visual Studio .NET

Symptom

  • Using RAS DataDefModel object.
  • Dynamically adding a table to the report at runtime and adding a table link.
  • Inner join is not enforced with the newly added table.

Environment

  • SAP Crystal Reports, developer version for Microsoft Visual Studio
  • Microsoft Visual Studio 2010 / 2012

Reproducing the Issue

  • Use the following code:

 

Dim _link As New CrystalDecisions.ReportAppServer.DataDefModel.TableLink
Dim _source As New CrystalDecisions.ReportAppServer.DataDefModel.Strings
Dim _destination As New CrystalDecisions.ReportAppServer.DataDefModel.Strings
Dim _join As New CrystalDecisions.ReportAppServer.DataDefModel.TableJoin
_source.Add(sec.FilterColumn)   '    destinationField)
_destination.Add(sec.FilterColumn)  'sourceField)
_link.JoinType = CrTableJoinTypeEnum.crTableJoinTypeEqualJoin
_link.SourceFieldNames = _source
_link.TargetFieldNames = _destination
_link.SourceTableAlias = securityView.Alias ' securityView.Name 'secureTable
_link.TargetTableAlias = secureTable
 
rd.ReportClientDocument.DatabaseController.AddTableLink(_link)
 
_join.SourceTableAlias = securityView.Alias
_join.TargetTableAlias = secureTable
_join.EnforceJoin = CrTableJoinEnforcedEnum.crTableJoinEnforcedBoth

 

Cause

  • There is no exposed API in the Crystal Reports SDK that would allow for this functionality

Resolution

Keywords

joyn cr crvs cr4vs 2012 2010 vs left right outer inner database , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio