﻿<?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 » WebForms (How do I?)  » Need to create a BO for multiple tables</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sun, 31 May 2026 21:03:17 GMT</lastBuildDate><ttl>20</ttl><item><title>Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21580.aspx</link><description>Hi There,&lt;/P&gt;&lt;P&gt;1)&lt;BR&gt;I need to search on multiple tables and the data from 20 TO 70GB&lt;/P&gt;&lt;P&gt;Since the data is pretty big I found out the best thing is to use a dynamic sql statement where I define on the fly the parameters to be used. I can NOT use a view with constant number of parameters since it will be too great of an impact on the execution plan.&lt;/P&gt;&lt;P&gt;I am trying to see how can I use a BO under this condition. For instant if the first sql gets 0 records, then in the same SP I will&amp;nbsp;pursue with another SQL statement to grab from different set of tables.&lt;/P&gt;&lt;P&gt;How do you assign a BO to this kind of process.&lt;/P&gt;&lt;P&gt;2)&lt;BR&gt;I need to use some audit trail. Like if the user enters FirstName, LastName and State for search purpose. I need to enter that as a record for an audit trail and then the results of the search as well. It could be up 100 records. Obviously that could be as a simple Insert. &lt;/P&gt;&lt;P&gt;How is the audit trail is coming along in the SF? Is that something that I can use?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Doron</description><pubDate>Sat, 14 Feb 2009 17:08:18 GMT</pubDate><dc:creator>Doron Farber</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21978.aspx</link><description>Hi Trent,&lt;P&gt;Thanks for the informative answer.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Doron</description><pubDate>Sat, 14 Feb 2009 17:08:18 GMT</pubDate><dc:creator>Doron Farber</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21943.aspx</link><description>Doron,&lt;/P&gt;&lt;P&gt;This is exactly what I had expected to see when I was posting my previous responses.&amp;nbsp; Here is what you need to do.&amp;nbsp; Create a SPROC that will retrieve all of the results that you are wanting to see, even if they come back in more than one result set.&lt;/P&gt;&lt;P&gt;Let's keep this simple.&amp;nbsp; Two tables:&lt;/P&gt;&lt;P&gt;Customers&lt;BR&gt;CustomerPhoneNumbers&lt;/P&gt;&lt;P&gt;Now I want to show in the list you provided all of the phone numbers in a flat list.&amp;nbsp; So the first thing I would do is get the query the way I like it, create a BO for each that may be used here (i.e. CustomersBO, CustomerPhoneNumbersBO).&amp;nbsp; Then I might treat this like a report if this is going to be for display purposes and then add a link (or whatever mechanism you intend to use) to an editing page if they want to make changes.&amp;nbsp; So in this case, I might inherit the CustomersBO and add all of the custom properties that I need for this display while not "messing up" the original BO since these custom properties will not be used everyone.&lt;/P&gt;&lt;P&gt;[codesnippet]Public Class MyCustomBo&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Inherits CustomersBO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Shared _PhoneNumbers As New CustomerPhoneNumbersBO()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Readonly Property PhoneNumbers() As CustomerPhoneNumbersBO&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get&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;&amp;nbsp;&amp;nbsp; Return _PhoneNumbers&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Property&lt;BR&gt;End Class[/codesnippet]&lt;/P&gt;&lt;P&gt;So now when I call my stored procedure that retrieves all of my result sets, I will dump it into this BO like this:&lt;/P&gt;&lt;P&gt;[codesnippet]Private _MyCustomBO As New MyCustomBo()&lt;/P&gt;&lt;P&gt;Private Sub LoadData()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim cmd As New SqlCommand("dbo.MySproc")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmd.CommandType = SqlCommandType.StoredProcedure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MicroFour.StrataFrame.Business.BusinessLayer.FillMultipleDataTables(cmd, _MyCustomBO, _MyCustomBO.PhoneNumbers)&lt;BR&gt;End Sub[/codesnippet]&lt;/P&gt;&lt;P&gt;So now I have a single entry point with two BOs.&amp;nbsp; This is the same type of logic you would use for a report.&amp;nbsp; So now, go one further and create a custom property to show all of the phone numbers on the entry point BO:&lt;/P&gt;&lt;P&gt;[codesnippet]Public Class MyCustomBo&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Inherits CustomersBO&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Shared _PhoneNumbers As New CustomerPhoneNumbersBO()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Readonly Property PhoneNumbers() As CustomerPhoneNumbersBO&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get&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;&amp;nbsp;&amp;nbsp; Return _PhoneNumbers&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Property&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Readonly Property My_PhoneNumbersAsHtml() As String&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get&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; Dim r As String = ""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Each bo As CustomerPhoneNumbersBO in _PhoneNumbers&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r &amp;amp;= bo.PhoneNumberAsText &amp;amp; "&amp;lt;br&amp;gt;"&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; Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return r&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Property&lt;BR&gt;End Class[/codesnippet]&lt;/P&gt;&lt;P&gt;This should get you going in the right direction.&lt;/P&gt;&lt;P&gt;&lt;BR&gt;&amp;nbsp;</description><pubDate>Thu, 12 Feb 2009 13:53:05 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21888.aspx</link><description>Hi Trent,&lt;/P&gt;&lt;P&gt;Still waiting for your reply.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Doron</description><pubDate>Mon, 09 Feb 2009 13:52:37 GMT</pubDate><dc:creator>Doron Farber</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21762.aspx</link><description>Hi Trent,&lt;P&gt;I tried your suggestion using WinForm as a test and it worked just fine and thanks for that. &lt;/P&gt;&lt;P&gt;But in order to use a BO I had to map it at least to one table. I used this code: e.BusinessObject.CurrentRow.Item("MyField") for the list view.&amp;nbsp; But I also need to do a lot of manipulation with the text, so I think if I have a BO with all fields involved in the query it could be easier. One thought is to use a dummy table with all fields involved in query and use that as the BO of the search, so this way I will have the Strong Type capability to process all fields.&lt;/P&gt;&lt;P&gt;Please advise if you have another or better idea for above. &lt;/P&gt;&lt;P&gt;I also would need to create a listview as shown in the below image. Do you know of any control that I can have such a look while I can create links within a cell etc... Or maybe there is a way of doing so using the SF ListView..&lt;/P&gt;&lt;P&gt;Please see this link to get the idea of how it has to be displayed:&amp;nbsp; &lt;A href="http://www.dfarber.com/joe_smith_data.png"&gt;http://www.dfarber.com/joe_smith_data.png&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Doron</description><pubDate>Mon, 02 Feb 2009 09:24:04 GMT</pubDate><dc:creator>Doron Farber</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21689.aspx</link><description>wow...I'll give that a try! :D</description><pubDate>Tue, 27 Jan 2009 10:35:20 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21675.aspx</link><description>Just type it in.&amp;nbsp; This is a combo box, not a drop down list, so you can type in whatever you want and it will try to use that field name.&amp;nbsp; If that field name doesn't exist...BOOM! :D</description><pubDate>Mon, 26 Jan 2009 15:42:30 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21672.aspx</link><description>I'm not quite sure if I understand the first method you indicated. When you say:&lt;br&gt;
&lt;br&gt;
[quote]You would add the column on the left with the name of the column that has been returned in the query.  You could then populate the column with a formatted value using the {index}.[/quote]&lt;br&gt;
&lt;br&gt;
If the column isn't a strongly typed property, it doesn't appear on the left, so how do you do this?  Is it just done in code?</description><pubDate>Mon, 26 Jan 2009 11:06:02 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21669.aspx</link><description>Hi Trent,&lt;P&gt;Thanks for your&amp;nbsp;&amp;nbsp;reply and let me try that and see how it comes...&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Doron</description><pubDate>Mon, 26 Jan 2009 10:15:15 GMT</pubDate><dc:creator>Doron Farber</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21668.aspx</link><description>I hope you understood that too Mr. Rijo.;)</description><pubDate>Mon, 26 Jan 2009 10:13:28 GMT</pubDate><dc:creator>Doron Farber</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21667.aspx</link><description>Thanks for clearing this up, I just hope Doron can also understand this :w00t:</description><pubDate>Mon, 26 Jan 2009 09:50:24 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21664.aspx</link><description>[quote] we have to enter the Field Name of the returned query? [/quote]&lt;/P&gt;&lt;P&gt;You would add the column on the left with the name of the column that has been returned in the query.&amp;nbsp; You could then populate the column with a formatted value using the {index}.&amp;nbsp; You could also use the populated through even option and populate the column from within the RowPopulating method and use the e.BusinessObject.CurrentRow.Item("MyField") option as well.</description><pubDate>Mon, 26 Jan 2009 09:25:01 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21661.aspx</link><description>[quote][b]Trent L. Taylor (01/25/2009)[/b][hr]It relates to a JOINed query.&amp;nbsp; At this point, it is just a matter of creating the query, and then &lt;STRONG&gt;within the list, enter the name of the field in the column that you want to show.&lt;/STRONG&gt;&amp;nbsp; You don't even have to create custom properties in this case.&amp;nbsp; The column name just has to be within the result set to prevent an error when the ListView tries to reference that column.&amp;nbsp; Another option, if you so choose, is to create custom properties that will expose these columns.&amp;nbsp; But this is something that we do all of the time within our applications and is very common practice.[/quote] &lt;P&gt;I am still a bit confused about how to build the listview to show the data from the query.&amp;nbsp; Do you mean that when building the listview instead of using {Index} to set the value we have to enter the Field Name of the returned query? or we have to do this in any of the listview event manually?</description><pubDate>Sun, 25 Jan 2009 18:48:43 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21657.aspx</link><description>Great!&amp;nbsp; So my logic is exactly what you want to do then as this is something that we do every day.&amp;nbsp; We have hundreds of places within our medical software that does this very thing.&amp;nbsp; It relates to a JOINed query.&amp;nbsp; At this point, it is just a matter of creating the query, and then within the list, enter the name of the field in the column that you want to show.&amp;nbsp; You don't even have to create custom properties in this case.&amp;nbsp; The column name just has to be within the result set to prevent an error when the ListView tries to reference that column.&amp;nbsp; Another option, if you so choose, is to create custom properties that will expose these columns.&amp;nbsp; But this is something that we do all of the time within our applications and is very common practice.</description><pubDate>Sun, 25 Jan 2009 18:34:58 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21635.aspx</link><description>&lt;FONT color=#0066cc&gt;Hi Trent,&lt;BR&gt;&lt;BR&gt;When it comes to search no need to update the server. I will need to create some SPs that will do as follows: If the user enters First, Last and State and the search yield 100 records which is the Max.&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#0066cc&gt;I will store the one record in table which is called: SearchValues which is the parent where I enter the values that the user entered initially, and then in the child will store only the pk of each found record and the table name. I haven't tried that yet, but that's the idea...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0066cc&gt;That's it when it comes to search. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0066cc&gt;I will have many types of search and this link may get you the idea: &lt;A href="http://www.PeopleFinders.com"&gt;http://www.PeopleFinders.com&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;Regards,&lt;BR&gt;&lt;BR&gt;Doron&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P style="BACKGROUND: white"&gt;&lt;P style="BACKGROUND: white"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #1f5080; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;A href="http://www.peoplefinders.com/"&gt;&lt;/A&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;A href="http://www.peoplefinders.com/"&gt;&lt;/A&gt;</description><pubDate>Thu, 22 Jan 2009 14:55:15 GMT</pubDate><dc:creator>Doron Farber</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21634.aspx</link><description>Do you want to update back to the server with this same result set?</description><pubDate>Thu, 22 Jan 2009 14:40:02 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21633.aspx</link><description>Hi Trent,&lt;P&gt;If you look that SP that was attached before it covers 6 tables (for the 2 sql statements) and I need to add more sql statements from other tables as well so this way maybe 12 tables will get involved. If one search in the first data set gets 0 records then it goes to next SQL statement and so forth... &lt;BR&gt;&lt;BR&gt;Hundreds of users will be logged into that server and perform search, and then I need constantly to reload too many BOs for one search at time not to mention the over head with all these BOs.&lt;BR&gt;&lt;BR&gt;I know that you&amp;nbsp;reduced the foot print of each BO but that also is&amp;nbsp;a concern as well.&lt;BR&gt;I would rather do that in one BO...&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Doron&lt;/P&gt;&lt;P&gt;&lt;BR&gt;&amp;nbsp;</description><pubDate>Thu, 22 Jan 2009 14:37:45 GMT</pubDate><dc:creator>Doron Farber</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21632.aspx</link><description>[quote][b]Trent L. Taylor (01/22/2009)[/b][hr]Why do you need this to be a single BO?[/quote]&lt;P&gt;Hi Trent,&lt;/P&gt;&lt;P&gt;Because Doron will be using a ListView to show the results, can we use multiple BO&amp;nbsp;sources in a ListView and display fields from each BO in the ListView?&lt;/P&gt;&lt;P&gt;Also, would it be too much of overhead to have 4 BO to show the ListView result?</description><pubDate>Thu, 22 Jan 2009 14:25:16 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21631.aspx</link><description>Why do you need this to be a single BO?</description><pubDate>Thu, 22 Jan 2009 13:26:04 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21630.aspx</link><description>Hi Trent,&lt;P&gt;Thanks for your reply.&amp;nbsp; &lt;BR&gt;&lt;BR&gt;I need to show the resulting data from the attached store procedure in a SF listview, I would like to use one single BO, but as you can see the SP is getting its data from 4 different tables, so I don't know how would I map the single BO to all those fields in the resulting SP cursor, it is this possible or is there any other approach I could use?&lt;/P&gt;&lt;P&gt;FYI, these are big tables with millions of records, so I must use the SP.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Doron</description><pubDate>Thu, 22 Jan 2009 10:57:08 GMT</pubDate><dc:creator>Doron Farber</dc:creator></item><item><title>RE: Need to create a BO for multiple tables</title><link>http://forum.strataframe.net/FindPost21589.aspx</link><description>1. This is exactly where you would create a stored procedure to return a result set (or more) back to one or more BOs.&amp;nbsp; The issue here is the search.&amp;nbsp; If you want to traverse large data sets with high response, you are going to have to use a number of things in conjunction to make this happen.&amp;nbsp; But the issue is not on the BO side, as you will just call a stored procedure to fill it.&amp;nbsp; The issue is creating the query/queries necessary to accept the parameter(s) and then efficiently execute the search.&lt;/P&gt;&lt;P&gt;If you will recall, Ben gave a nice session during the training class on SQL Server Optimization and SPROCS.&amp;nbsp; This is exactly where that lesson comes in very nicely.&lt;/P&gt;&lt;P&gt;As for the BO, you can map it to a pre-existing table or view or even create custom properties.&amp;nbsp; In most cases that I have ever dealt with, you are generally searching data that represents more than one table in this type of scenario which may split into more than one table.&amp;nbsp; This is fine, you would just make your SPROC return more than one result set and then populate the BOs in question.&amp;nbsp; This is a great place to use the BusinessLayer.FillMultipleDataTables method.&lt;/P&gt;&lt;P&gt;2. You are going to want and do this server side.&amp;nbsp; The SF auditing is mostly in place, but the issue here if you are trying to do verbose auditing is that you are going to impede performance.&amp;nbsp; So in this case, you&amp;nbsp;are probably beter off creating triggers on the SQL side to automatically handle the UPDATE/DELETEs to place the changes into your auditing table.&amp;nbsp; You will want to be careful here too and just keep an eye on optimization so that things don't slow down server side.</description><pubDate>Tue, 20 Jan 2009 22:58:24 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>