crystal reports

shireeshn

Member
Hi all,

i have moved my table from one database to other database in progress. and i created my views for crystal reports.

new database --> A
old database --> B

i have a problem in crystal reports due to moveing the tables to other database, but still linking of table in crystal report to old database(A) only.

Do i have to manually unlink all the database table in crystal reports and add again ? or do we have any other method to do this automatically?

Can any one help me on this.

Thanks in advance.
 

schaapie

Member
Is it not enough to change the datasource name of the odbc-connection you are using asuming you use this?

Otherwise you could try something like:
Code:
def var codbcnaam as char no-undo init 'newname'.
/* kbases: P115877 P122620 P55350 P47202 P106992 P115258 */
function ConnectTables returns logical (input ichReport as com-handle):
  def var iTeller     as int no-undo.
  def var chConnProps as com-handle no-undo.
  def var chTable     as com-handle no-undo.
  do iTeller = 1 to ichReport:Database:tables:count:
    chTable = ichReport:database:tables(iTeller).
    /* Set the Connection Info to Connection Properties of the table object */
    chConnProps = chTable:ConnectionProperties.
    /* don't rename extra external datasources */
    if not can-do("dwh,test_dwh",chconnProps:item("DSN"):value)
    then
      next.
    /* Clear the ConnectionProperties collection */
    chConnProps:DeleteAll.
    /* Add the ODBC DSN */
    chConnProps:ADD("DSN", cODBCNaam).
    /* Add the database level User ID if required */
    chConnProps:ADD("User ID", "rapportage").
    /* Add the database level password if required */
    chConnProps:ADD("Password", "rapportage").
 
    /* Location is set so also commands can be changedd */
    /* Use either of the following statements to override the Catalog name if the report has been created using OpenEdge 10.1B or later - see P122620 for more information*/
    /* chTable:Location = "<Database Name>". */
    /* chTable:SetTableLocation("<Database Name>","",""). */
    chTable:location = cODBCNaam no-error.
    if not chTable:TestConnectivity()
    then
       message 'error cant connect'.
This renames/reconnects the tables which use datasource dwh or test_dwh to a new datasource with the name cODBCNaam.
 

shireeshn

Member
hi schaapie,
i am not lanching the crystal report using comhandle. it is lanched by using crwprt.i..

for this also it works ? is this code related to this ?
 
Top