Message 1 of 20
Having Difficulty With IsDone Method of OdRecords in Object Data Code

Not applicable
02-04-2005
05:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have created a routine to make a non-existing table and populate it with
data from text entities I create from insertion point coordinates I get from
a text file.
I was able to do the process above and attach records to said created acadObjects
and everything seems to be looking good. As a check I go look into each of those
objects and go Map/object data/edit object data and I see the table I created
populated by the data I pushed for each one of those texts that I created.
Next I tried to retrieve information from those attached texts and put them in
an array using code below but everytime I test it with " If Not odRcs.IsDone "
as shown below or "If odRcs.IsDone=true" it does not flag me for any error at all
instead it goes merrily on its way saying it does not have any data i.e. it is
done -- I looped through my dataset with more than 100 text and not even one of
it seems to have data using the if test I did above. :
For Each entA In sel
Set aoj = ThisDrawing.ObjectIdToObject(entA.ObjectID)
blnGotRcs = odTb.GetODRecords.init(aoj, True, False)
Set odRcs = odTb.GetODRecords
If Not odRcs.IsDone Then
For intCnt = 0 To odRcs.Record.Count - 1
Set odRc = odRcs.Record(intCnt)
'whatever is in the grid will be take from external database
If UCase(Trim(odRc("PointNumber").Value)) = UCase(Trim(strKeyValue)) Then
ReDim varReturn(4)
varReturn(0) = UCase(Trim(odRc("pointnumber").Value))
varReturn(1) = UCase(Trim(odRc("xcoordinate").Value))
varReturn(2) = UCase(Trim(odRc("ycoordinate").Value))
varReturn(3) = UCase(Trim(odRc("zelevation").Value))
varReturn(4) = UCase(Trim(odRc("description").Value))
varReturn(5) = UCase(Trim(odRc("csvfilename").Value))
End If
Next intCnt
End If
Next entA
So I checked and double checked that all my odRecords objects are all set to nothing
after I am done using it. But even that did not solve the problem.
I tried to look back at how I created the attachment and see if there
was any error generated at all.
blnAbleToAttach = odRc.AttachTo(aoj.ObjectID)
And the returned blnAbleToAttach is TRUE so even in the other function that attaches the
data it does not report any error at all.
Because cannot find anything obviously wrong next is I started thinking maybe I need
an equivalent of recordset.update in ADO so I experimented adding
blnUpdatedOdRcs = odRcs.Update(odRc) into my code that tries to attach data to objects:
For intCtrr = LBound(varRecords) To UBound(varRecords)
odRc.Item(intCtrr).Value = varRecords(intCtrr)
Next intCtrr
blnUpdatedOdRcs = odRcs.Update(odRc)
blnAbleToAttach = odRc.AttachTo(aoj.ObjectID)
But it gave me a new error something like "update of odRecords object failed"
Next I tried :
For intCtrr = LBound(varRecords) To UBound(varRecords)
odRc.Item(intCtrr).Value = varRecords(intCtrr)
blnUpdatedOdRcs = odRcs.Update(odRc)
Next intCtrr
blnAbleToAttach = odRc.AttachTo(aoj.ObjectID)
Still the same problem "update of odRecords object failed", and it looks like I am just
going around in circle. Please help me what is it that I am not doing right?
I gratefully appreciate all the help you can give me on this
Thanks,
Matt
data from text entities I create from insertion point coordinates I get from
a text file.
I was able to do the process above and attach records to said created acadObjects
and everything seems to be looking good. As a check I go look into each of those
objects and go Map/object data/edit object data and I see the table I created
populated by the data I pushed for each one of those texts that I created.
Next I tried to retrieve information from those attached texts and put them in
an array using code below but everytime I test it with " If Not odRcs.IsDone "
as shown below or "If odRcs.IsDone=true" it does not flag me for any error at all
instead it goes merrily on its way saying it does not have any data i.e. it is
done -- I looped through my dataset with more than 100 text and not even one of
it seems to have data using the if test I did above. :
For Each entA In sel
Set aoj = ThisDrawing.ObjectIdToObject(entA.ObjectID)
blnGotRcs = odTb.GetODRecords.init(aoj, True, False)
Set odRcs = odTb.GetODRecords
If Not odRcs.IsDone Then
For intCnt = 0 To odRcs.Record.Count - 1
Set odRc = odRcs.Record(intCnt)
'whatever is in the grid will be take from external database
If UCase(Trim(odRc("PointNumber").Value)) = UCase(Trim(strKeyValue)) Then
ReDim varReturn(4)
varReturn(0) = UCase(Trim(odRc("pointnumber").Value))
varReturn(1) = UCase(Trim(odRc("xcoordinate").Value))
varReturn(2) = UCase(Trim(odRc("ycoordinate").Value))
varReturn(3) = UCase(Trim(odRc("zelevation").Value))
varReturn(4) = UCase(Trim(odRc("description").Value))
varReturn(5) = UCase(Trim(odRc("csvfilename").Value))
End If
Next intCnt
End If
Next entA
So I checked and double checked that all my odRecords objects are all set to nothing
after I am done using it. But even that did not solve the problem.
I tried to look back at how I created the attachment and see if there
was any error generated at all.
blnAbleToAttach = odRc.AttachTo(aoj.ObjectID)
And the returned blnAbleToAttach is TRUE so even in the other function that attaches the
data it does not report any error at all.
Because cannot find anything obviously wrong next is I started thinking maybe I need
an equivalent of recordset.update in ADO so I experimented adding
blnUpdatedOdRcs = odRcs.Update(odRc) into my code that tries to attach data to objects:
For intCtrr = LBound(varRecords) To UBound(varRecords)
odRc.Item(intCtrr).Value = varRecords(intCtrr)
Next intCtrr
blnUpdatedOdRcs = odRcs.Update(odRc)
blnAbleToAttach = odRc.AttachTo(aoj.ObjectID)
But it gave me a new error something like "update of odRecords object failed"
Next I tried :
For intCtrr = LBound(varRecords) To UBound(varRecords)
odRc.Item(intCtrr).Value = varRecords(intCtrr)
blnUpdatedOdRcs = odRcs.Update(odRc)
Next intCtrr
blnAbleToAttach = odRc.AttachTo(aoj.ObjectID)
Still the same problem "update of odRecords object failed", and it looks like I am just
going around in circle. Please help me what is it that I am not doing right?
I gratefully appreciate all the help you can give me on this
Thanks,
Matt