Skip to Content
avatar image
Former Member

Changing link properties between tables

Hello,

Is it possible to change somehow properties for the links between tables?

We have about 2000 reports and we should change most of the links, it would be very convenient to write short program to do this instead of destroying couple mouses and wrists etc...

Currently we are using VB6 and RDC to work with reports but we are open for all ideas to solve this problem we have.

Thanks in advance for any help!

Timo

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 20, 2008 at 01:52 PM

    Hello Timo,

    Some link properties are exposed via the SDK, others are not.

    In the RDC documentation, you can look up the TableLink object to see which properties are exposed, and there's a tutorial section "How to add and delete table links" in the docs as well.

    Sincerely,

    Ted Ueda

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Timo,

      Unless you know exactly how all are going to change exactly it may be easier to hire a student to this for you.

      Here's a bit of code that should get you going, it's old but should work for you also. You'll need to know what fields are mapped etc... It actually adds the tables at runtime and what you'll want to do is get your existing tables and links and save the info in an array.

      Dim db As Database

      Set db = rep.Database

      Dim tables As ICRDatabaseTables

      Set tables = db.tables

      Dim desTable As ICRDatabaseTable

      Dim path As String

      Dim srcTable As ICRDatabaseTable

      Dim subloc As String

      ' Add a table.

      subloc = "Orders"

      Set srcTable = tables.Add(subloc, CRDTRecurringFile, "crdb_ODBC.DLL", "MS SQL Tsvanfps01", "nwind", "vantech", "vantech", subloc)

      ' Add a table.

      subloc = "Employees"

      Set desTable = tables.Add(subloc, CRDTRecurringFile, "crdb_ODBC.DLL", "MS SQL Tsvanfps01", "nwind", "vantech", "vantech", subloc)

      Dim links As ICRDatabaseLinks

      Set links = db.links

      Dim count As Long

      count = links.count

      Dim joinType As CRJoinType

      Dim lookType As CRLookUpType

      Dim pm As Boolean

      Dim indexInUse As Integer

      joinType = 5 ' set to Left Outer Join

      lookType = 2

      pm = False ' used for Access tables

      indexInUse = 0 ' used for Access tables

      Dim vas As Variant

      Dim vbs As Variant

      vas = Array(2) ' pointer to the field position in the source Table

      vbs = Array(0) ' pointer to the field position in the destination Table

      Dim newdblink As ICRDatabaseLink

      Set newdblink = links.Add(srcTable, desTable, vas, vbs, joinType, lookType, pm, indexInUse)

      Have fun

      Don