Excluding a field in the BO Mapper...


Author
Message
StarkMike
StarkMike
StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Is there a way to exclude fields from being used in the BO?
Daniel Essin
Daniel Essin
StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)
Group: Forum Members
Posts: 235, Visits: 309
Same question from me.
StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Do you mean through the business object mapper?

If you want to exclude a column from being produced, you can "customize" the field (right-click the field within the BOMapper -> Customize Field -> Check "Use Custom Code" -> don't enter anything in the custom code blank.  When the partial class is built, the property will be omitted.

If you mean at runtime, then yes, you can retrieve a subset of the columns from the database because the DataTable's structure is independent of the business object's properties, however, when you want to save a business object, you will need all of the columns present, or you will get an error while saving.

StarkMike
StarkMike
StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)
Group: Forum Members
Posts: 436, Visits: 944
When I click on 'Customize Code' then leave the field blank and click Ok, it unchecks it.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Put carriage return or two into the custom field area and it will allow you to omit the field. Wink
StarkMike
StarkMike
StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Ok, I don't think its working. I added the carriage return and it saved the custom code but didn't exclude the field from the BO.



Here's the real reason I'm asking about excluding a field...I have a table that has a primary key composed of two fields. Neither of these fields is an autonumber... they rely on the combinatio of the data in both these fields to be unqiue to form the primary key. Then I have a field called UniqueID which is an autonumber field but it isnt a primary key. So when I edit these records and then try to save the changes it's throwing a fit because it can't update the autonumber field. I thought if I could just exclude the field from the BO that would solve the problem, but maybe thats not the approach you would suggest.



StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No, what you need is the ability to exclude a column from the update.  Paul Chase is running into the same problem with his RowGuidCol he's using for replication... you can't update is once it's been INSERTED.  I'm running through the possible options right now.  Easiest thing would be to have a property where you declare the columns that should be excluded from updates.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I didn't read the entire thread.  I was just assuming to exclude the strong-typed property.  OopsBigGrin.
StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
That's what I assumed at first as well, then Mike explained what he was tring to do, and I noticed Paul was having the same problem with his guid values for replication.
StarkMike
StarkMike
StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)StrataFrame User (494 reputation)
Group: Forum Members
Posts: 436, Visits: 944
I thought maybe I could create a view that was identical to the table then just exclude the column from the view. Then use the view in the mapper for the structure. But when I tried to save my changes it said it couldn't create an update statement because there were no PrimaryKeyFields. Is that an error because I cant bind a view to the BO or am I missing something?
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