Skip to Content
avatar image
Former Member

Updating TTX path in CR file

Hi Everyone,

We are having the issue that CR will display an login screen if the path to the TTX is not available if we move the report to a different server.

I tried *many* different methods to change this path. Sometimes the new path is not stored in the object. Other times it does store the value, but it seems that the old value is being used when I save the report.

I made a code example with a write / save / read cycle and the corresponding output:

Add-Type -AssemblyName 'CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304'
Add-Type -AssemblyName 'CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304'


write-host ''


[system.string] $reportpath = 'C:\Users\u\Desktop\Order.rpt'
[system.string] $reportdstpath = 'C:\Users\u\Desktop\Order2.rpt'


[CrystalDecisions.CrystalReports.Engine.ReportDocument] $Report = New-Object CrystalDecisions.CrystalReports.Engine.ReportDocument
$Report.Load($reportpath)


write-host 'Connection 0'
$report.DataSourceConnections[0].SetConnection("C:\test.ttx", '', '', '')
$report.DataSourceConnections[0].Attributes.Collection


write-host '
Connection 1'
$report.DataSourceConnections[1].SetConnection("C:\test.ttx", '', '', '')
$report.DataSourceConnections[1].Attributes.Collection


Remove-Item -Force -Path $reportdstpath -ErrorAction Continue
$report.SaveAs($reportdstpath)


$Report = New-Object CrystalDecisions.CrystalReports.Engine.ReportDocument
$Report.Load($reportdstpath)


write-host '
Connection 0'
$report.DataSourceConnections[0].Attributes.Collection


write-host '
Connection 1'
$report.DataSourceConnections[1].Attributes.Collection

The output is like this. Please note that connection 0 has the new ServerDescription (TTX path) applied, while connection 1 does not. Could anyone explain what I'm doing wrong?

Connection 0


Name                                                                                    Value                                                                                  
----                                                                                    -----                                                                                  
Database DLL                                                                            crdb_odbc.dll                                                                          
QE_DatabaseName                                                                                                                                                                
QE_DatabaseType                                                                         ODBC (RDO)                                                                             
QE_LogonProperties                                                                      CrystalDecisions.Shared.DbConnectionAttributes                                         
QE_ServerDescription                                                                    C:\test.ttx                                                                            
QE_SQLDB                                                                                True                                                                                   
SSO Enabled                                                                             False                                                                                  


Connection 1
Database DLL                                                                            crdb_fielddef.dll                                                                      
QE_DatabaseName                                                                                                                                                                
QE_DatabaseType                                                                                                                                                                
QE_LogonProperties                                                                      CrystalDecisions.Shared.DbConnectionAttributes                                         
QE_ServerDescription                                                                    F:\Data Files\Axerrio\DDF\axspFetchRepControlList_RS2.ttx                              
QE_SQLDB                                                                                False                                                                                  
SSO Enabled                                                                             False                                                                                  


Connection 0
Database DLL                                                                            crdb_odbc.dll                                                                          
QE_DatabaseName                                                                                                                                                                
QE_DatabaseType                                                                         ODBC (RDO)                                                                             
QE_LogonProperties                                                                      CrystalDecisions.Shared.DbConnectionAttributes                                         
QE_ServerDescription                                                                    C:\test.ttx                                                                            
QE_SQLDB                                                                                True                                                                                   
SSO Enabled                                                                             False                                                                                  


Connection 1
Database DLL                                                                            crdb_fielddef.dll                                                                      
QE_DatabaseName                                                                                                                                                                
QE_DatabaseType                                                                                                                                                                
QE_LogonProperties                                                                      CrystalDecisions.Shared.DbConnectionAttributes                                         
QE_ServerDescription                                                                    F:\Data Files\Axerrio\DDF\axspFetchRepControlList_RS2.ttx                              
QE_SQLDB                                                                                False                                                                                  
SSO Enabled                                                                             False                                                                                  


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers