Adding Custom Fields To BO Datatable


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
I've seen a forum post on this before but can't seem to locate it.



I want to add a few temporary fields to a business object's datatable on a row by row basis to store status information but can't seem to get it to work properly at runtime. I don't want to add the fields to the database table, just to the business object.



Any help would be appreciated.



Thanks,

Tim

Replies
Dustin Taylor
Dustin Taylor
StrataFrame Team Member (938 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Yep, what Edhy said Smile

If you explicitly don't want a strong-typed property, then you can use the methods I described in my original post, and reference bo.CurrentRow.Item("yourcolumname") to get or set it. Since it isn't explicitely defined in the BO, it won't save back to the database. If you do want to use a strong-typed property (which is generally much cleaner), then you'll want to add it to the FieldsToExcludeFromUpdate as Edhy mentioned to prevent it from saving back to the database.

Thanks Edhy. Sadly, the Mexican Circus got another Strong Man and weren't interested in a Bearded Lady, so I had to come back Wink.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Tim,



One last thing that might make life easier. You can use your query that fills the BO to make that extra column. I.e. extending the example



SELECT

-- First three columns are all "official" columns and will be saved by the BO

cs_FirstName,

cs_LastName,

cs_ID,

-- Any number of "extra" columns can be added as needed.

FALSE AS cs_Processed, -- this adds a column to underlying datatable with a default value

0 AS cs_Status -- Example of a couple more added columns, an int and a string

'P' As cs_StatusDisplay

FROM Customers



Using this method, you can then use either of the methods Dustin described to access/change the data.
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
Thanks guys, your examples helped solve my problem.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Glad you got it working!
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