runtime business object creation


Author
Message
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
Yes, Fabian, that will work, but you'll need to make sure that you remove the filter when you're done or you won't be able to Navigate or Move to any new records.
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
Trent L. Taylor (09/24/2007)
Well, a business object has a CopyDataFrom method that allows data from one BO to be copied to another. This also has some overloads and parms that allow you to specify whether you want to copy the filtered BO (DefaultView) or the CurrentDataTable which ignores the filter. So if you want to copy a single record, apply a filter to the source BO then call the CopyDataFrom on the destination BO using a DefaultView option.



SourceBO.Filter = "MyPK = " & SourceBO.MyPk.ToString()

DestBO.CopyDataFrom(SourceBO,ClearAndFillFromDefaultView)




how I can say something like "MyPK = " & SourceBO.MyPK.Tostring() in a general manner to filter the current record? I say something like:



me.primarybusinessObject.filter = me.primarybusinessObject.PrimaryKeyField.Tostring() & "=" & me.primarybusinessobject.(me.PrimaryBusinessObject.PrimaryKeyField.tostring())



Thanks and sorry for all the questions w00t
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You will want to use the base class which would be BusinessLayer:

Dim _CopyBO As MicroFour.StrataFrame.Business.BusinessLayer

This will allow any BO to be passed into that variable while giving you the ability to reference all of the base classes.  If you want to have the type of BO passed in then you will want to take a more technical approach using Generics.  This is a more length explanation as Generics are a wonderful tool but they require more explanation.

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
thanks for reply, my question I think is more a .net question about object types, I don't sure how to define the destination object in run time without known what type of BO it is



Example:I have a me.PrimaryBusinessObject, when I press a "Copy" button I handle it....



Sub Copy_Click

' I like to copy the current record on the me.Primarybusinessobject to a variable

' called _CopyBO (it can be testbo1, otherBo1 or another BO)

dim _CopyBO as XXXXXXX '<--- how I declare the type of the primarybusinessobject here?

'Copy the row from XXXBO1 to _CopyNO....

' some code here....

end sub



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

Thanks Smile
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, a business object has a CopyDataFrom method that allows data from one BO to be copied to another.  This also has some overloads and parms that allow you to specify whether you want to copy the filtered BO (DefaultView) or the CurrentDataTable which ignores the filter.  So if you want to copy a single record, apply a filter to the source BO then call the CopyDataFrom on the destination BO using a DefaultView option.

SourceBO.Filter = "MyPK = " & SourceBO.MyPk.ToString()
DestBO.CopyDataFrom(SourceBO,ClearAndFillFromDefaultView)

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
I not sure if I clear on the last post, I try to make something like the VFP "scat memo" / appe blank / "gath memo" to copy a record into another new record, I not sure if a temporal 1-row business object is the correct stuff to do

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
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