Setting up a grid / BO with related fields


Author
Message
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: 7K
thegwill, if I understand what you are trying to accomplish, then I am going to add to Greg's comment.  You do not have to actually have the field strong-typed through the BO mapper.  Let assume that you want to create an alias field or produce a custom field via your query, then even without creating a custom property on the BO you can access that field through the Item property on the BO.  The field will exist in the internal data table but it will just not have a strong-typed property.  So you could then create a custom property to access it if the need exists.  Let me know if this is what you are trying to accomplish.
Peter Jones
Peter Jones
Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Guys,

A fortuitous thread - I think I have the a similar issue and was going to go down the custom field path but, before I start working out how to do that, perhaps you can say if the custom field approach will work in my case.

I have a BO based on a table that has three FKs which are not maintainable in the BO however I want to show the “Name” associated with each FK when I display the row details in a grid. My cunning plan was:

1) Create the BO on the table.
2) Use a stored procedure to populate the BO that has all the columns in the source table plus joins on the three FKs so I can extract the Name value associated with each FK value. This will give me three extra columns: Name1, Name2 and Name3.
3) I was then going to create three custom fields in my BO called (you guessed it) Name1, Name2 and Name3.

I then “hoped” that when I created my Business Binding Source the custom fields would be visible so that I could include them in my grid and these fields would be automatically bound to Name1 etc from the stored proc. Is this the way it works?

Cheers, Peter

thegwill
thegwill
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: 16, Visits: 177
Thanks Greg but this isn't really what I'm after. I understand the custom field concept but I am looking to retrieve the "custom field" from a related table as per the SQL

If I were to follow the "custom field" approach then surely I would need to hit the database again? This is what I am trying to avoid...

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Check out custom fields in help. I do this all the time. They can be setup to be bindable also.
thegwill
thegwill
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: 16, Visits: 177
In my database I have TableA which has a FK to TableB

In my project I have BizObA which consists of fields from TableA. I would also like it to include a field from TableB as it's related via an FK

If I were writing the SQL it would be something like:

SELECT A.Field, A.AnotherField, B.SomeField
FROM TableA A
INNER JOIN TableB B
ON A.FK = B.PK

...but I'm not sure how this is achieved using the BO Mapper so that BizObA truly represents my business object and not just reflects a table structure

I guess I could have a separate BizObB to point at TableB and stitch them together but this seems like a bad idea

Once I have my BizObB I want to bind it to a grid using the BBS...

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