﻿<?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?)  / Map BO to MS Access view / 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>Mon, 06 Oct 2008 22:18:36 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Map BO to MS Access view</title><link>http://forum.strataframe.net/Topic14945-6-1.aspx</link><description>[quote]My question was if I could fill a datatable with more columns than properties mapped in the BO mapper.[/quote]&lt;/P&gt;&lt;P&gt;Yes, you can.  Each business object wraps a DataTable, and that DataTable can have all sorts of extra columns containing data.  By the same token, you can also fill a business object with fewer fields than are mapped to the business object... just don't try to retrieve the data through one of the properties or you'll get an exception :)&lt;/P&gt;&lt;P&gt;Once you have the extra columns in the table, there are a few ways to retrieve the values.  You can use the indexer property of the business object:&lt;/P&gt;&lt;P&gt;myBo["columnName"]&lt;/P&gt;&lt;P&gt;or you can use the current row:&lt;/P&gt;&lt;P&gt;myBo.CurrentRow["columnName"]&lt;/P&gt;&lt;P&gt;or you can create a property on the business object that wraps the current row's indexer.  Simply copy one of the properties created by the BOMapper and change the names to protect the innocent.</description><pubDate>Tue, 18 Mar 2008 08:50:07 GMT</pubDate><dc:creator>Ben Chase</dc:creator></item><item><title>RE: Map BO to MS Access view</title><link>http://forum.strataframe.net/Topic14945-6-1.aspx</link><description>Thanks,&lt;/P&gt;&lt;P&gt;I already knew how to code the fill method. My question was if I could fill a datatable with more columns than properties mapped in the BO mapper.&lt;/P&gt;&lt;P&gt;I have already solved my problem changing my DB backend to SQL Server :D. This project is for me my first test project with Strataframe (I have developed before with Powerbuilder, C# + NHibernate or Datasets) and I'm testing the same project with Oracle, SqlServer an Access.&lt;/P&gt;&lt;P&gt;Thanks a lot for our answers. I think this help forum is great and our support fast and good.&lt;/P&gt;&lt;P&gt;Alex B.</description><pubDate>Tue, 18 Mar 2008 04:27:49 GMT</pubDate><dc:creator>Alex Bibiano González</dc:creator></item><item><title>RE: Map BO to MS Access view</title><link>http://forum.strataframe.net/Topic14945-6-1.aspx</link><description>Yup. Edhy is right on the money.  You will just create a method within your BO that executes that query for you.</description><pubDate>Mon, 17 Mar 2008 13:28:30 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Map BO to MS Access view</title><link>http://forum.strataframe.net/Topic14945-6-1.aspx</link><description>[quote][b]Alex Bibiano González (03/17/2008)[/b][hr]Thanks for your replays. I will try your suggestion but I need a little more help.&lt;P&gt;I have read the link, but don't understand where to put the query in my BO:&lt;/P&gt;&lt;P&gt;[codesnippet]SELECT Staff.*, SchoolTitles.TitleName FROM Staff INNER JOIN SchoolTitles ON Staff.ForeignKey = SchoolTitles.PrimaryKey[/codesnippet]&lt;/P&gt;&lt;P&gt;Can I retrieve in my fill method more columns than the columns I mapped in the BO mapper?&lt;/P&gt;&lt;P&gt;Can I create a BO with all fields as custom properties? (because my BO don't maps directly to a table, and I can't use the BO mapper tool)&lt;/P&gt;&lt;P&gt;Thanks and excuse for my ignorance&lt;/P&gt;&lt;P&gt;Alex B.[/quote]&lt;P&gt;Hi Alex,&lt;P&gt;No problem, so here we go.....&lt;OL&gt;&lt;LI&gt;In the Solution Explorer, right click your BO file and select View Code&lt;/LI&gt;&lt;LI&gt;Open the Region "Data Retrieval Methods" and create a method here which you will call from anywhere in your form, so let's named it something like GetStaffView and the code should be something like this in VB:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;[codesnippet]&lt;FONT size=2&gt;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; GetStaffView()&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;     Me&lt;/FONT&gt;&lt;FONT size=2&gt;.FillDataTable(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"SELECT Staff.*, SchoolTitles.TitleName FROM Staff INNER JOIN SchoolTitles ON Staff.ForeignKey = SchoolTitles.PrimaryKey"&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;[/codesnippet]&lt;P&gt;You will then call the Me.GetStaffView method from your form's New or Load event or from any other place you want the BO to be populated.&lt;P&gt;I believe you will also need to create a Custom Field Property to manage the SchoolTitles.TitleName, but I am not sure, so if that is the case let me know to give you some code to do that, or look at the help for the Custom Field Property topic, so you can add it in the same BO file.</description><pubDate>Mon, 17 Mar 2008 12:07:47 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Map BO to MS Access view</title><link>http://forum.strataframe.net/Topic14945-6-1.aspx</link><description>Thanks for your replays. I will try your suggestion but I need a little more help.&lt;/P&gt;&lt;P&gt;I have read the link, but don't understand where to put the query in my BO:&lt;/P&gt;&lt;P&gt;[codesnippet]SELECT Staff.*, SchoolTitles.TitleName FROM Staff INNER JOIN SchoolTitles ON Staff.ForeignKey = SchoolTitles.PrimaryKey[/codesnippet]&lt;/P&gt;&lt;P&gt;Can I retrieve in my fill method more columns than the columns I mapped in the BO mapper?&lt;/P&gt;&lt;P&gt;Can I create a BO with all fields as custom properties? (because my BO don't maps directly to a table, and I can't use the BO mapper tool)&lt;/P&gt;&lt;P&gt;Thanks and excuse for my ignorance&lt;/P&gt;&lt;P&gt;Alex B.</description><pubDate>Mon, 17 Mar 2008 11:46:44 GMT</pubDate><dc:creator>Alex Bibiano González</dc:creator></item><item><title>RE: Map BO to MS Access view</title><link>http://forum.strataframe.net/Topic14945-6-1.aspx</link><description>Alex,&lt;/P&gt;&lt;P&gt;We actually use OLEDB to talk to Access and call the GetSchema to return the views...apparently the Access OLEDB provider doesn't return views as a table.  I can add this to a list to look at before the next update, but Edhy is correct in that you could create a query that does this form you. &lt;/P&gt;&lt;P&gt;Access has full ANSI 92 SQL support which means that you can use JOINs, etc, which is all that a view is doing for you anyway...especially as it relates to read-only data.  Here is one post that I have recently talked about how to create an INNER JOIN: &lt;A href="http://forum.strataframe.net/FindPost14603.aspx"&gt;http://forum.strataframe.net/FindPost14603.aspx&lt;/A&gt; . (It is the same thread that Edhy mentioned).</description><pubDate>Mon, 17 Mar 2008 10:47:23 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Map BO to MS Access view</title><link>http://forum.strataframe.net/Topic14945-6-1.aspx</link><description>Hi Alex,&lt;/P&gt;&lt;P&gt;Take a look at the following post, it may give you an idea of how to JOIN another table in the BO and then create some Custom Field Properties in your BO.&lt;/P&gt;&lt;P&gt;&lt;A href="http://forum.strataframe.net/Topic14580-6-1.aspx?Highlight=join"&gt;http://forum.strataframe.net/Topic14580-6-1.aspx?Highlight=join&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Of course this is in case you will not be able to use your Access view directly in your BO which would be the easiest way for you.</description><pubDate>Mon, 17 Mar 2008 10:14:31 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Map BO to MS Access view</title><link>http://forum.strataframe.net/Topic14945-6-1.aspx</link><description>Thanks for replay but I'm not sure how to do this.&lt;/P&gt;&lt;P&gt;I want to populate the BO only for read purpouse, and the view I have in access is a union from 2 tables with some calculated fields (it's not only a talbe with a where filter).&lt;/P&gt;&lt;P&gt;I think it would be more simple to map the view directly to a BO and use this BO to populate my controls (it's a tree list).&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Alex B.</description><pubDate>Mon, 17 Mar 2008 09:57:01 GMT</pubDate><dc:creator>Alex Bibiano González</dc:creator></item><item><title>RE: Map BO to MS Access view</title><link>http://forum.strataframe.net/Topic14945-6-1.aspx</link><description>Hi Alex,&lt;/P&gt;&lt;P&gt;I don't know if you can use MS Access views, but maybe you don't really need the view since you can create as many BO with all the filtering and parameters you want to.&lt;/P&gt;&lt;P&gt;Remember that the BO is basically a container for your data and you have to create the SQL statement to bring the data to work with.</description><pubDate>Mon, 17 Mar 2008 09:06:57 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>Map BO to MS Access view</title><link>http://forum.strataframe.net/Topic14945-6-1.aspx</link><description>Can I mapp a BO to a MS Access view?&lt;/P&gt;&lt;P&gt;I have the BO, the view in the mdb, but if I call the BO Mapper tool, only tables are displayed.&lt;/P&gt;&lt;P&gt;Is it possible?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Alex B.</description><pubDate>Mon, 17 Mar 2008 09:04:03 GMT</pubDate><dc:creator>Alex Bibiano González</dc:creator></item></channel></rss>