Create a collection from business object


Author
Message
Jason Seidell
Jason Seidell
StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)
Group: Forum Members
Posts: 59, Visits: 180
I cannot figure out how to extract a set of information from a SF BO to a collection.  I want seperate objects that I can pass around and change the properties of without having to be tied to one BO, and without any concern of the BO's being written back to the database, or one subroutine navigating the BO and breaking the caller sub b/c it didn't realize the recordset was changed, or having to manually reset the BO back to whatever record I was looking at before.

The closest thing I could find would be to serialize and deserialize all the results into new objects, which I think would work??  But seems to complex, there should be a simpler solution.

Jason Seidell

Programmer/Analyst

Infinedi

Replies
Jason Seidell
Jason Seidell
StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)StrataFrame User (153 reputation)
Group: Forum Members
Posts: 59, Visits: 180
That would solve sorta half my problem. Let me elaborate.



Let's says I have an object myBO, it has pulled 10 records from a database. I want to be able to create another object BOentry and set it to an instance of the first record in myBO. Then I may play around with myBO moving back and forth looking at other records but leaving BOentry still pointing to the first record. So here's some imaginary code



' Create a business object

myBO = New SampleBO

myBO.Fill10()



' Now get an instance to the first record

Dim BOentry as SampleBO

BOentry = myBO



Call FindNextEntry(myBO) ' Some other function that may navigate the myBO



BOentry = ??? ' At this point I have no clue what BOentry is pointing to since BOentry is simply a shallow copy (only pointing to myBO, and not a specific instance (or row) of information within myBO) if FindNextEntry called a MoveLast then BOentry is now pointing to the last record in myBO not the first. The simpliest solution is to be able to create a new SampleBO object that truly contains an indepedent instance of the object. For example, lets see it with a collection instead



myColl = New Collection()

FillCollection(myColl) ' Add the rows to my collection



' Create a new object

Dim CollEntry as SampleObject()

CollEntry = myColl.Item(1)



Call FindNextEntry(myColl) ' Some other function that may play around with the collection



CollEntry = myColl.Item(1) ' CollEntry is still pointing to the same instance of the object

Jason Seidell

Programmer/Analyst

Infinedi

Robin J Giltner
Robin J Giltner
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 105, Visits: 650
Would simply copying the data from myBO to your BOEntry suffice ?

Dim loBusinessObject as new BusinessObjectType

loBusinessObject.CopyDataFrom(myBO, Microfour.Strataframe.Business.BusinessCloneDataType.ClearandFillfromDefaulView)

would get you a complete copy of the original business object's data as a completely different instance of the BusinessObject type.

I might be misunderstanding what you are needing here. (also complete guess on the ClearandFillfromDefaulValue enum, but I think that is close)

Robin Giltner

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search