Setting up a grid / BO with related fields


Author
Message
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...

Reply
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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.





Just one more step:



4. Override the GetCustomBindablePropertyDescriptors method to include each of the custom properties that you want to be bindable. There is info about this in help (I think). If you have trouble, I'll post an example.





Note that if your custom properties are readonly, then the BO will never enable them for editing (assuming normal SF binding).



You might also want to track when you call the fill method that fills the BO with the FK names, so you can gracefully handle (or informatively throw an exception) if you access on of the properties when those extra columns are in the data table.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
thegwill - 18 Years Ago
Greg McGuffey - 18 Years Ago
thegwill - 18 Years Ago
Peter Jones - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Greg McGuffey - 18 Years Ago
Trent L. Taylor - 18 Years Ago
                         Glad the headache is gone...that is never fun.
Greg McGuffey - 18 Years Ago
Greg McGuffey - 18 Years Ago
thegwill - 18 Years Ago
Peter Jones - 18 Years Ago
Greg McGuffey - 18 Years Ago
Edhy Rijo - 18 Years Ago
Peter Jones - 18 Years Ago
             Glad that helped :D
Greg McGuffey - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search