runtime business object creation


Author
Message
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Hi guys, I try to make a generic ABM, on it I dropped a "copy" button and it must copy the current record of the primary business object on a private business object



example: I'm retrieving on the ABM a product's table, my currentrowindex is 23 and I like to copy this on a temporary business object with only this record, I not sure how to declare the private variable



private _boCopy as XXXXXX



XXXXX mean that I known what is the primary object (the form property say it) but I don't known how to say something like

dim _boCopy as (the type of Myform.PrimaryBusinessObject)



Thanks and sorry for me newbie questions w00t
Replies
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Solution to this topic (I think :crazySmile



dim _copybo as gettype(me.primarybusinessobject) '<---- something like this exist on VB?




I found the solution w00t I have to take some class on .net Blush



My "full" working code:

--------------

Private _CopyBO As MicroFour.StrataFrame.Business.BusinessLayer

Dim sOldFilter As String = Me.PrimaryBusinessObject.Filter

Dim _CurrentRowIndex As Integer = Me.PrimaryBusinessObject.CurrentRowIndex



Me.PrimaryBusinessObject.Filter = Me.PrimaryBusinessObject.PrimaryKeyField & " = " & Me.PrimaryBusinessObject(Me.PrimaryBusinessObject.PrimaryKeyField)



'Instantiate a object from the same type as the primaryBusinessObject

_CopyBO = Activator.CreateInstance(Me.PrimaryBusinessObject.GetType)



_CopyBO.CopyDataFrom(Me.PrimaryBusinessObject, MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable)



Me.PrimaryBusinessObject.Filter = sOldFilter



'Me.NavigateToPrimaryKey(_RegistroEnMemoriaBO(_RegistroEnMemoriaBO.PrimaryKeyField))[/quote]



Now I have a _CopyBO with 1-row copy of my actual PrimaryBusinessObject Smile



Thanks and sorry for all the posts that I write for a simple topic (because my dificulties to write more understand posts)
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Fabian,



I think that the code posted won't have just one record (unless the primary BO only has one record). When you do the CopyDataFrom, you need to supply the ClearAndFillFromDefaultView option to get just the filtered records.



Of course, if what you do have works, I'm not understanding what's happening BigGrin
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yep, Greg is correct... if you filter out all but 1 row, and you want to copy just that one row, then you will need to use the ClearAndFillFromDefaultView.  The other option (ClearAndFillFromCompleteTable) will ignore the filter you set on the business object.
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Hello guys, that's right, some cut & paste to show the example and I make another mistake w00t I learn the clearandfillfrom... stuff thanks for all the help and support Smile



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Fabian R Silva, - - 18 Years Ago
Fabian R Silva, - - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Fabian R Silva, - - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Fabian R Silva, - - 18 Years Ago
StrataFrame Team - 18 Years Ago
                         How To obtain the current record from the PrimaryBusinessObject of a...
Fabian R Silva, - - 18 Years Ago
                             I say "Victory" too fast

when I set
Private _CopyBO As...
Fabian R Silva, - - 18 Years Ago
                                 Have you built the partial class for the BO you are working with?
Trent L. Taylor - 18 Years Ago
                                     Yes, I build all the project to test it, I tested with some BOs and...
Fabian R Silva, - - 18 Years Ago
                                         Yes, this message is because the partial class has not been built....
Trent L. Taylor - 18 Years Ago
                                             [quote][b]Trent L. Taylor (09/28/2007)[/b][hr]Yes, this message is...
Fabian R Silva, - - 18 Years Ago
                                                 Solution to this topic (I think :crazy:)

[quote]dim _copybo...
Fabian R Silva, - - 18 Years Ago
                                                     Fabian,

I think that the code posted won't have just one...
Greg McGuffey - 18 Years Ago
                                                         Yep, Greg is correct... if you filter out all but 1 row, and you want...
StrataFrame Team - 18 Years Ago
                                                             Hello guys, that's right, some cut & paste to show the example and I...
Fabian R Silva, - - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search