Adding New Column to existing OD table and Updating based on other OD table

Adding New Column to existing OD table and Updating based on other OD table

Anonymous
Not applicable
336 Views
0 Replies
Message 1 of 1

Adding New Column to existing OD table and Updating based on other OD table

Anonymous
Not applicable
What I am trying to accomplish:

1) add a new column to existing OD table (Identity_Data)
2)populate new column with area that is in other OD table(TPMCNTR_identity)
3)move data from OD table into oracle where it will be joined with other tables (code already complete and working)

Note: both of these OD tables are attached to the same centroid.

Is it possible to do this?

I attempted to update two unnecessary columns in the identity_data table with the area & topology_ID from the TPMCNTR_identity table, but my code doesn't seem to work. I tried this to see if i could avoid creating a new column.

Dim amap As AcadMap
Dim acadObj As Object
Dim ODtb As ODTables
Dim prj As Project
Dim CaODrcs As ODRecords
Dim ZnODrcs As ODRecords
Dim boolVal As Boolean
Dim ssetObj As AcadSelectionSet
Dim i As Integer
Dim fType(1) As Integer
Dim fData(1) As Variant
Dim Pnt1(2) As Double
Dim Pnt2(2) As Double
Dim Counter As Integer
Dim ZnODrc As ODRecord
Dim ZnODtb As ODTable
Dim CaODrc As ODRecord

Set amap = ThisDrawing.Application.GetInterfaceObject("AutoCADMap.Application")

Pnt1(0) = 474000: Pnt1(1) = 5450000: Pnt1(2) = 0
Pnt2(0) = 495000: Pnt2(1) = 5480000: Pnt2(2) = 0

'sets the table collection
Set prj = amap.Projects.Item(ThisDrawing)
prj.ProjectOptions.DontAddObjectsToSaveSet = True
Set ODtb = prj.ODTables


Set ZnODrcs = ODtb.Item("Identity_Data").GetODRecords

Set CaODrcs = ODtb.Item("TPMCNTR_Identity").GetODRecords

'adds new objects to the selection set
fType(0) = 0
fType(1) = 8
fData(0) = "Point"
fData(1) = "0"

Set ssetObj = ThisDrawing.SelectionSets.Add("TEST26")

'attempting to add all centriods on layer "0" to selection
ssetObj.Select acSelectionSetWindow, Pnt1, Pnt2, fType, fData
MsgBox ssetObj.COUNT

'bulding sql string
Counter = 0
For Each acadObj In ssetObj
Counter = Counter + 1
'boolVal = ZnODrcs.Init(acadObj, True, False)
boolVal = CaODrcs.Init(acadObj, True, False)
'MsgBox ODrcs.Record.tableName
'MsgBox ODrcs.Record.ObjectID

For i = 0 To CaODrcs.Record.COUNT - 1
MsgBox "in loop"
MsgBox CaODrcs.Record.Item(i).Value
If i = 1 Then
Set ZnODrcs = ODtb.Item("Identity_Data").GetODRecords
Set ZnODrc = ZnODrcs.Record

ZnODrc.Item(8).Value = 10
boolVal = ZnODrcs.Update(ZnODrc)
MsgBox ZnODrc.Item(8).Value

ElseIf i = 2 Then
'ZnODrc.Record.Item(9).Value = CaODrc.Record.Item(i).Value
'boolVal = ZnODrcs.Update(ZnODrc)
End If

Next i
MsgBox "i am here"

Next

End Sub
0 Likes
337 Views
0 Replies
Replies (0)