﻿<?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 / Business Objects and Data Access (How do I?)  / Is There a Safety Limit to the Number of BOs on a Form? / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>forum@strataframe.net</webMaster><lastBuildDate>Tue, 02 Dec 2008 16:42:13 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Is There a Safety Limit to the Number of BOs on a Form?</title><link>http://forum.strataframe.net/Topic13981-6-1.aspx</link><description>Sure.  It really depends on what I am trying to accomplish.  But let's take the scenario that you have a lot of BOs that must be loaded and there may be a number of child BOs that need to be loaded as well.  In this case, the easiest solution is to use the ThreadManager class and load each of the child BOs (and potentially the parents as well) on a thread.  For example, let's take the scenario below:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Tables with Respective BOs&lt;/STRONG&gt;&lt;BR&gt;Customers (Parent BO)&lt;BR&gt;CustomerNotes (Child)&lt;BR&gt;CustomerProducts (Child)&lt;BR&gt;CustomerOrders (Child)&lt;/P&gt;&lt;P&gt;Now let's assume that I have the primary key of the parent (there are a lot of different scenarios that you can work this format into).  I am going to load the parent first, then load all of the children at the same time.&lt;/P&gt;&lt;P&gt;[codesnippet]'-- Load the parent record&lt;BR&gt;Customers.FillByPrimaryKey(customerPK)[/codesnippet]&lt;/P&gt;&lt;P&gt;OK, once the parent is loaded (and if you have the PK you may not really need to wait for the parent to load...but you get the idea) I want to spawn 3 threads to load all of the children at the same time.  The best way to do this is to create a method for each child BO to load:&lt;/P&gt;&lt;P&gt;[codesnippet]Private Sub Fill_CustomerNotes()&lt;BR&gt;    CustomerNotes.FillByParentPrimaryKey(Customers.cust_Pk)&lt;BR&gt;End Sub&lt;/P&gt;&lt;P&gt;Private Sub Fill_CustomerProducts()&lt;BR&gt;    CustomerProducts.FillByParentPrimaryKey(Customers.cust_Pk)&lt;BR&gt;End Sub&lt;/P&gt;&lt;P&gt;Private Sub Fill_CustomerOrders()&lt;BR&gt;    CustomerOrders.FillByParentPrimaryKey(Customers.cust_Pk)&lt;BR&gt;End Sub[/codesnippet]&lt;/P&gt;&lt;P&gt;But I still need to call these on a thread.  Drop a ThreadManager on the form and name it something like, threadManagerChildrenRecords.  Once the parent BO has been loaded (or you are ready to load the children) start a process for each fill method:&lt;/P&gt;&lt;P&gt;[codesnippet]threadManagerChildRecords.AddProcess(Addressof Fill_CustomerNotes, "Notes")&lt;BR&gt;threadManagerChildRecords.AddProcess(Addressof Fill_CustomerProducts, "Products")&lt;BR&gt;threadManagerChildRecords.AddProcess(Addressof Fill_CustomerOrders, "Orders")[/codesnippet]&lt;/P&gt;&lt;P&gt;Once each thread completes, the ThreadCompleted event will fire and you can test on the name of the thread specified in the AddProcess call.  In most cases, though, you can just handle the AllThreadsCompleted event of the thread manager to launch your post query logic (i.e. populate a list, grid, etc.).&lt;/P&gt;&lt;P&gt;This is a pretty basic overview, but it should at least give you some ideas.  We have taken this to another level in our medical software to even load the form (folders in our medical software) on a background thread and the once completed bring it to the main thread...this would require a much longer explanation.  But we use the logic explained above for the loading of child records in a number of occasions once the form has been loaded.  Hope that makes sense :)</description><pubDate>Tue, 05 Feb 2008 19:39:26 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Is There a Safety Limit to the Number of BOs on a Form?</title><link>http://forum.strataframe.net/Topic13981-6-1.aspx</link><description>Trent, I have a few forms that could probably benefit from some threading.  Could you say a bit more about this, especially with regards to how this works with the FormLoad option for BOs, combos/lists, what objects do you load in background, etc.  I sorta know about threading, but have much to learn in this area.&lt;br&gt;&lt;br&gt;Thanks!</description><pubDate>Tue, 05 Feb 2008 18:00:11 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Is There a Safety Limit to the Number of BOs on a Form?</title><link>http://forum.strataframe.net/Topic13981-6-1.aspx</link><description>Yeah, I have some forms that have as many as 10+ ChildFormDialogs and 20+ BOs...however, I will start to thread things, etc. if the forms starts to feel, "sluggish." :)  This is generally due to the number of objects being instantiated and then loading the BOs....so you can always mask the loading slowness by using threads.</description><pubDate>Tue, 05 Feb 2008 10:00:19 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Is There a Safety Limit to the Number of BOs on a Form?</title><link>http://forum.strataframe.net/Topic13981-6-1.aspx</link><description>Excellent!  That is good to hear.&lt;/P&gt;&lt;P&gt;Sounds like my form is a walk in the park compared to yours.  These things can get complicated quick, though.  All a user has to say is, "Do think we could add a ... ?"&lt;/P&gt;&lt;P&gt;No, wait...here's the real problem.  We say, "Sure."&lt;/P&gt;&lt;P&gt;:hehe:</description><pubDate>Mon, 04 Feb 2008 15:43:15 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Is There a Safety Limit to the Number of BOs on a Form?</title><link>http://forum.strataframe.net/Topic13981-6-1.aspx</link><description>We have a form with 26 Business objects, 11 sub classed BrowseDialogs, and a few other components with no problems.  Our form takes a second to load up in the application, but we haven't heard any complaints about form load times or anything so we haven't tried to change it to make it faster.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Robin Giltner</description><pubDate>Mon, 04 Feb 2008 15:27:59 GMT</pubDate><dc:creator>Robin J Giltner</dc:creator></item><item><title>Is There a Safety Limit to the Number of BOs on a Form?</title><link>http://forum.strataframe.net/Topic13981-6-1.aspx</link><description>I have a rather (in my opinion) complex form involving 14 business objects (so far).  Should I be considering some kind of safety limit to the number of business objects I am throwing on a form?  Also, I have three ChildFormDialogs on the same form...is there concern for those, as well?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR&gt;Bill</description><pubDate>Mon, 04 Feb 2008 09:19:17 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item></channel></rss>