﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Setting up a grid / BO with related fields</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Thu, 21 May 2026 19:42:51 GMT</lastBuildDate><ttl>20</ttl><item><title>Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11640.aspx</link><description>In my database I have TableA which has a FK to TableB&lt;P&gt;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&lt;/P&gt;&lt;P&gt;If I were writing the SQL it would be something like:&lt;/P&gt;&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;EM&gt;SELECT A.Field, A.AnotherField, B.SomeField &lt;BR&gt;FROM TableA A &lt;BR&gt;INNER JOIN TableB B &lt;BR&gt;ON A.FK = B.PK&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;...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&lt;/P&gt;&lt;P&gt;I guess I could have a separate BizObB to point at TableB and stitch them together but this seems like a bad idea&lt;/P&gt;&lt;P&gt;Once I have my BizObB I want to bind it to a grid using the BBS...</description><pubDate>Fri, 28 Sep 2007 22:55:58 GMT</pubDate><dc:creator>thegwill</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11763.aspx</link><description>Hi Greg,&lt;/P&gt;&lt;P&gt;Thanks for such a detail response, it helps me a lot.</description><pubDate>Fri, 28 Sep 2007 22:55:58 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11719.aspx</link><description>Glad that helped :D</description><pubDate>Wed, 26 Sep 2007 18:53:40 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11718.aspx</link><description>Hi Greg,&lt;/P&gt;&lt;P&gt;Thanks for taking the time to write Arrays 101 - your comments are indeed very helpful.&lt;/P&gt;&lt;P&gt;Cheers, Peter</description><pubDate>Wed, 26 Sep 2007 16:00:27 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11713.aspx</link><description>Yeah, that whole curly bracket thing confused the heck out of me at first too.  It is related to arrays. First lets look at some simple array examples:&lt;br&gt;
&lt;br&gt;
[codesnippet]' An array of strings&lt;br&gt;
Dim names As String()&lt;br&gt;
' An array of integers&lt;br&gt;
Dim ages As Integer()&lt;br&gt;
'An array of FieldPropertyDescriptors&lt;br&gt;
Dim descriptors As FieldPropertyDescriptor()[/codesnippet]&lt;br&gt;
&lt;br&gt;
You probably already figured out this is how you dim an array.  Of course, then you have to Redim it to the correct size and then add each item, which is a pain lots of times:&lt;br&gt;
&lt;br&gt;
[codesnippet]' Dim an array of names&lt;br&gt;
Dim names As String()&lt;br&gt;
'...later in code, size and fill the array&lt;br&gt;
Redim names As String(2)&lt;br&gt;
names(0) = "Joe"&lt;br&gt;
names(1) = "John"[/codesnippet]&lt;br&gt;
&lt;br&gt;
As you likely know, with other types of variables, you can just set the value or initialize the variable when you dim it.  But how do you do that with an array?  Arrays need to be sized before adding elements to them and the elements are added by index.  That is were the curly brackets come into play.  The curly brackets are array initializers and allow you set the initial values of the array:&lt;br&gt;
&lt;br&gt;
[codesnippet]' An array of strings&lt;br&gt;
Dim names As New String() {"Joe","Bob","Sam"}&lt;br&gt;
' An array of integers&lt;br&gt;
Dim ages As Integer() {23, 34, 56}&lt;br&gt;
'An array of &lt;br&gt;
Dim descriptors As FieldPropertyDescriptor() { _&lt;br&gt;
             New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _&lt;br&gt;
                                    "Product", GetType(boPUNAllocatedToFleshBatch)), _&lt;br&gt;
             New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _&lt;br&gt;
                                    "BinCode", GetType(boPUNAllocatedToFleshBatch))}[/codesnippet]&lt;br&gt;
&lt;br&gt;
So, the curly brackets simply allow you to initialize the array with values when you create the array.  Note that you do [b]NOT[/b] set the size of the array when you use an initializer (the curly brackets). You can also use initializers with multi dimension arrays. In that case, you need to set the rank of the array, but not the size:&lt;br&gt;
&lt;br&gt;
[codesnippet]' Array of names, first in 0 and last in 1&lt;br&gt;
Dim names As String(,) { {"Joe", "John"}, {"Smith","Simpson"} } [/codesnippet]&lt;br&gt;
&lt;br&gt;
Hope that helps!</description><pubDate>Wed, 26 Sep 2007 12:27:26 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11693.aspx</link><description>Hi Guys,&lt;/P&gt;&lt;P&gt;Yes - it all worked as advertised (in the SF Help) - thanks a lot. The only issue I had (being a .Net newbie) was how to get all my (seven off) custom fields into GetCustomBindablePropertyDescriptors. This turned out to be easy but I thought I would post the code in this thread in case someone else has similare issues. It hasn't sunk in what yet as to the special meaning of the swiggly braket but my offsider pointed out what I needed to do.&lt;/P&gt;&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; Protected Overrides Function GetCustomBindablePropertyDescriptors() As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return New MicroFour.StrataFrame.Business.FieldPropertyDescriptor() { _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Product", GetType(boPUNAllocatedToFleshBatch)), _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "BinCode", GetType(boPUNAllocatedToFleshBatch)), _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "ReceiveBatch", GetType(boPUNAllocatedToFleshBatch)), _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "FleshingBatch", GetType(boPUNAllocatedToFleshBatch)), _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "ShortTermBatch", GetType(boPUNAllocatedToFleshBatch)), _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "TanningBatch", GetType(boPUNAllocatedToFleshBatch)), _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "OrderNo", GetType(boPUNAllocatedToFleshBatch))}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;/P&gt;&lt;P&gt;Cheers, Peter</description><pubDate>Wed, 26 Sep 2007 00:27:02 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11684.aspx</link><description>Thanks for the tip(s) guys. The day job is taking over at the moment so I'll give it a try soon...&lt;/P&gt;&lt;P&gt;BTW, it would be really helpful to have a "recipe" book of such topics for SF noobs like myself (you know the kind of thing, like the o'reilly books).</description><pubDate>Tue, 25 Sep 2007 13:31:32 GMT</pubDate><dc:creator>thegwill</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11680.aspx</link><description>Glad the headache is gone...that is never fun.</description><pubDate>Tue, 25 Sep 2007 11:32:08 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11676.aspx</link><description>Ah...yeah, thanks Greg.&amp;nbsp; That is correct...and a very important step :D&amp;nbsp; I was trying to answer the forum questions last night with a pounding headache...stupid I know :blush: .... but today...headache gone and back to work :D</description><pubDate>Tue, 25 Sep 2007 09:30:14 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11669.aspx</link><description>[quote]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.[/quote]&lt;br&gt;
&lt;br&gt;
There are about a million bloody ways to access data with SF.  I'm constantly amazed.  I hadn't thought of this way at all....:blink:</description><pubDate>Mon, 24 Sep 2007 22:18:57 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11668.aspx</link><description>[quote]1)Create the BO on the table.&lt;br&gt;
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.&lt;br&gt;
3)I was then going to create three custom fields in my BO called (you guessed it) Name1, Name2 and Name3.&lt;br&gt;
[/quote]&lt;br&gt;
&lt;br&gt;
Just one more step:&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Note that if your custom properties are readonly, then the BO will never enable them for editing (assuming normal SF binding).   &lt;br&gt;
&lt;br&gt;
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.</description><pubDate>Mon, 24 Sep 2007 22:16:53 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11660.aspx</link><description>thegwill, if I understand what you are trying to accomplish, then I am going to add to Greg's comment.&amp;nbsp; You do not have to actually have the field strong-typed through the BO mapper.&amp;nbsp; 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.&amp;nbsp; The field will exist in the internal data table but it will just not have a strong-typed property.&amp;nbsp; So you could then create a custom property to access it if the need exists.&amp;nbsp; Let me know if this is what you are trying to accomplish.</description><pubDate>Mon, 24 Sep 2007 20:53:46 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11659.aspx</link><description>Hi Guys,&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;Create the BO on the table.&lt;BR&gt;2)&amp;nbsp;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.&lt;BR&gt;3)&amp;nbsp;I was then going to create three custom fields in my BO called (you guessed it) Name1, Name2 and Name3.&lt;BR&gt;&lt;/P&gt;&lt;P&gt;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&amp;nbsp;be automatically&amp;nbsp;bound to Name1 etc from the stored proc.&amp;nbsp;Is this the way it works?&lt;BR&gt;&lt;/P&gt;&lt;P&gt;Cheers, Peter&lt;BR&gt;</description><pubDate>Mon, 24 Sep 2007 18:58:01 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11655.aspx</link><description>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&lt;/P&gt;&lt;P&gt;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...</description><pubDate>Mon, 24 Sep 2007 14:53:45 GMT</pubDate><dc:creator>thegwill</dc:creator></item><item><title>RE: Setting up a grid / BO with related fields</title><link>http://forum.strataframe.net/FindPost11649.aspx</link><description>Check out custom fields in help.  I do this all the time. They can be setup to be bindable also.</description><pubDate>Mon, 24 Sep 2007 11:02:40 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item></channel></rss>