Custom Fields on Business Object


Author
Message
Tim Dol
Tim Dol
Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
Is it possilbe to create a custom field in a business object to store temporary data for each row without creating a actual field in the database.

I tried creating a custom field in the business object and a Private variable to store and retrieve the value but it appears to only keep the last value.

I'm open to suggestions if this isn't the correct approach.  Basically I want to end up with a place to store / retrieve information in the business object for each row without having to create an extra field in the table.

Thanks

Tim

Replies
Larry Caylor
Larry Caylor
StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
Another method that I use to store the temporary custom fields in the BOs data table. I usually add the custom colums in the select statement that fills the BO. Once the colums have been added I use the custom field properties to maintian them.

<Browsable(False), _
BusinessFieldDisplayInEditor(), _|
Description(
"Custom field"), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public Property cust_Field() As String
  
Get
       
Return Me.CurrentRow.Item("CustomField").ToString
  
End Get
  
Set(ByVal value As String)
      
Me.CurrentRow.Item("CustomField") = value
  
End Set
End Property

Since the BO uses the AllFieldsNames property when saving or updating the object, the added fields are simply ignored.

-Larry

 


Tim Dol
Tim Dol
Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)Advanced StrataFrame User (666 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
I'm trying to use these properties on grids so I added the custom bindable property descriptions but when I try to update I get an error indicating that the field isn't part of the business object.

Are these properties supposed to be bindable?

Thanks

TIm

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'm wondering if the problem is that you are using a grid. I'm thinking out loud here...normal SF data binding is controlled by the BO but binding to a grid is through a BusinessBindingSource to the DataTable, so that might be the problem.



If the extra data is temporary and you don't need to persist it, then the dictionary method would likely work better. If you do need to persist it, then it looks like it could get complicated. Sorry this isn't a more definitive answer Unsure I hope this helps you keep moving on the problem though Smile



Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Gregg is probably on the right track.

I had quite a bit of trouble using the BBS and ended up making my own class for that. 

Basically what happens with a BBS is for every row in the business object that you are binding to, a new instance of the business object is created and represent that row and its datatable is shared with the first main bo.

The problem is that if you have any properties , events etc set on the main bo the lose they're values in the newly created instance. hope that makes sense

However I would think because the datatable is shared you should be able to make it work somehow.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Tim Dol - 18 Years Ago
Edhy Rijo - 18 Years Ago
Tim Dol - 18 Years Ago
Greg McGuffey - 18 Years Ago
                     Greg, this is perfect. Thanks a lot! :)
Tim Dol - 18 Years Ago
                         Any time :D
Greg McGuffey - 18 Years Ago
Larry Caylor - 18 Years Ago
Tim Dol - 18 Years Ago
Greg McGuffey - 18 Years Ago
Paul Chase - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search