Using Custom Fill Methods on BO


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
Does the AllFieldsList property of your business object contain that field?  Also, what is the full exception that you're getting?  Having the stack trace will help point me in the right direction.
Bradley Marston
Bradley Marston
StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)
Group: Forum Members
Posts: 24, Visits: 119
I have a BO that is mapped to a table. To fill the object I call

the FillbyStoredProc method. The stored proc that is called adds 1 additional field

from another table all seems fine except when i try to call my update stored proc

then I seem to get a data layer exception on this added field, Oddly it does not happen on calling my insert proc

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
Gary is correct.  The order of the columns in the returned result set does not matter.  Also, the columns returned to not have to exactly match the field properties on the business object.  On a per-column basis, what Gary said is correct... the name and the data type have to match.  But, you can have more or fewer columns in the return result set than the strong typed field properties on the business object.  If you have a property that doesn't have a corresponding column in the DataTable, you cannot access it (because there's no data behind the property), so don't touch it in code if the field is not in the DataTable.  However, if you have a column in the table that doesn't have a field property, you can access it through the .Item (default/indexer) property like this (comes in handy for joins and aggregate fields like COUNTs and such):

myBO("MyField") = "some value" '-- VB

myBO["MyField"] = "some value"; //-- C#

Gary Wynne
Gary Wynne
StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)
Group: Forum Members
Posts: 10, Visits: 40

Hi

> When creating a Custom Fill Method does the Data Retrieval order have to match the Business Object Definition order or will the BO auto map the fields to the properties based on the column names?

I assume you are referring to the order of the columns in your returned result set? If so, it doesn't matter to the SF business object. It will read and write the data to the column in the inner DataTable (referenced by the CurrentDataTable property). As long as they are named the same and are of the same datatype/precision, you will be good to go.

HTH

-=Gary

Richard Keller
Richard Keller
StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)StrataFrame User (174 reputation)
Group: Forum Members
Posts: 84, Visits: 324
 When creating a Custom Fill Method does the Data Retrieval order have to match the Business Object Definition order or will the BO auto map the fields to the properties based on the column names?

Thanks for your help.

Richard

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