﻿<?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?)  » How do I filter a business object by a custom property?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sun, 10 May 2026 10:14:58 GMT</lastBuildDate><ttl>20</ttl><item><title>How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost13788.aspx</link><description>When I attempt to filter a BO on a custom property, the debugger tells that the specified column does not exist.&amp;nbsp; It is true that it cannot be found in the DB, but it is on the BO.&amp;nbsp; Is there a trick to filtering on a custom property?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR&gt;Bill</description><pubDate>Fri, 27 Jun 2008 11:43:14 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17426.aspx</link><description>Since the form's purpose is to display information only, I set the AutoShowSaveChangesMessage on the maintenance form to 'false.'&amp;nbsp; That took care of it.</description><pubDate>Fri, 27 Jun 2008 11:43:14 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17425.aspx</link><description>Glad you got it going, Bill! ;)&lt;P&gt;[quote]There are a couple of outstanding issues...the main one is that once I set a column's value in the CurrentDataTable the row is now dirty and the BO wants to save whenever I exit the &amp;#119;indow.[/quote]&lt;/P&gt;&lt;P&gt;Not sure this is the recommended way, I'm sure you will be adviced against it if not. Have you tryed issuing a SAVE&amp;nbsp;right after you modifiy all your custom field values? This is what I'm doing, anyway! :)&lt;/P&gt;&lt;P&gt;As this column is not part of your table, nothing will happen to it, I suppose.</description><pubDate>Fri, 27 Jun 2008 11:06:49 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17424.aspx</link><description>I thought I would try to wrap up this thread with a play-by-play of what I did to solve the problem.&amp;nbsp; Thanks [b]everyone[/b] for all of the help!&lt;/P&gt;&lt;P&gt;[hr]&lt;/P&gt;&lt;P&gt;1)&amp;nbsp; Added code to the CurrentDataTableInitialized and CurrentDataTableRefilled (per Trent and Ivan)&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; (CurrentDataTable.Columns[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"spxInventoryQty"&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;] == &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;null&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;) { CurrentDataTable.Columns.Add(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DataColumn&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"spxInventoryQty"&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;typeof&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;decimal&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;))); }&lt;/FONT&gt;&lt;/FONT&gt;[/codesnippet]&lt;P&gt;&lt;FONT size=2&gt;&lt;/P&gt;&lt;/FONT&gt;2)&amp;nbsp; Altered the custom property to a basic structure (no reference to the new column)&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;FONT size=2&gt;[&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&amp;lt;snipped&amp;gt;&lt;/FONT&gt;&lt;FONT size=2&gt;]&lt;BR&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;decimal&lt;/FONT&gt;&lt;FONT size=2&gt; InventoryQty&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;decimal&lt;/FONT&gt;&lt;FONT size=2&gt; mInvQty = 0;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// calculate the amount on hand (pending)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;mInvQty = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.onhandqty; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// use the invalid value for now (for testing)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; mInvQty;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/FONT&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;3)&amp;nbsp; Filled the BO that applies a similar filter to what I wanted in the BO (removed that part of the problem entirely)&lt;/P&gt;&lt;P&gt;4)&amp;nbsp; Set all new data column values to the existing value of the custom property (note: using the various code supplied in this thread, the best I could do was fill the first row with data from the custom properties...the rows' column data mostly&amp;nbsp;stayed empty)&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;FONT color=#0000ff size=2&gt;private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; SetColumnValues()&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;foreach&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;PartsBO&lt;/FONT&gt;&lt;FONT size=2&gt; mBO &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;in&lt;/FONT&gt;&lt;FONT size=2&gt; partsBO1.GetEnumerable())&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; partsBO1.CurrentDataTable.Rows[partsBO1.CurrentRowIndex][&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"spxInventoryQty"&lt;/FONT&gt;&lt;FONT size=2&gt;] = partsBO1.InventoryQty;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/FONT&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;5)&amp;nbsp; Create a dataset from the CurrentDataTable(s) to be the data source for the DevEx Grid (necessary for the master/detail gridviews, BBS bypassed)&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;FONT color=#2b91af size=2&gt;DataSet&lt;/FONT&gt;&lt;FONT size=2&gt; ds = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DataSet&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;BR&gt;ds.Tables.Add(partsBO1.CurrentDataTable);&lt;BR&gt;ds.Tables.Add(salesOrderDetailsBO1.CurrentDataTable);&lt;BR&gt;ds.Relations.Add(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"SalesOrders"&lt;/FONT&gt;&lt;FONT size=2&gt;, ds.Tables[0].Columns[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"partindex"&lt;/FONT&gt;&lt;FONT size=2&gt;], ds.Tables[1].Columns[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"partindex"&lt;/FONT&gt;&lt;FONT size=2&gt;], &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;false&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;BR&gt;PartsGridControl.DataSource = ds.Tables[0];&lt;BR&gt;PartsGridControl.LevelTree.Nodes.Add(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"SalesOrders"&lt;/FONT&gt;&lt;FONT size=2&gt;, SalesOrderView);&lt;BR&gt;PartsGridControl.RefreshDataSource();&lt;/FONT&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;[hr]&lt;/P&gt;&lt;P&gt;There are a couple of outstanding issues...the main one is that once I set a column's value in the CurrentDataTable the row is now dirty and the BO wants to save whenever I exit the &amp;#119;indow.&amp;nbsp; I will do some searching on how to prevent saves in this situation.&amp;nbsp; I am sure it has been covered in the docs or other forum entries.&amp;nbsp; The secondary one is that the&amp;nbsp;lookup data in the related sales order grid (e.g. customer name, unit description, etc.)&amp;nbsp;is always empty.&amp;nbsp; Since this is new water for me, I will do my due diligence and research the DevEx grid more throroughly and come up with a solution.&lt;/P&gt;&lt;P&gt;Thanks, again, for everyone's help!&amp;nbsp; Naturally, if anyone sees something that may help me improve things, feel free to let me know.&lt;/P&gt;&lt;P&gt;Have a great day!&lt;BR&gt;Bill</description><pubDate>Fri, 27 Jun 2008 10:21:26 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17419.aspx</link><description>Thanks for reviewing the code, Ivan.&amp;nbsp; Yup, just left it out, since I am replacing it with the newer properties that I shared with you.</description><pubDate>Thu, 26 Jun 2008 16:13:37 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17418.aspx</link><description>Hey Bill.&lt;/P&gt;&lt;P&gt;Don't even know wether this would make a difference or not, but had a look at your code and couldn't see the "OnSalesOrder" property defined (which you create a Descriptor for)... I guess you just didn't post it, is that so?</description><pubDate>Thu, 26 Jun 2008 16:08:03 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17417.aspx</link><description>[quote][b]Paul Chase (06/26/2008)[/b][hr]If your customer property work's fine with textbox's but not with a BBS then what does that tell you?[/quote]&lt;/P&gt;&lt;P&gt;I am focusing on the BBS, as mentioned in an earlier post (following Greg's suggestion to return a constant).&amp;nbsp; My biggest issue is why the code works for one grid and not another.&amp;nbsp; Both have BOs with custom properties flowing through a BBS to the grid.&lt;/P&gt;&lt;P&gt;I'll continue to grind it out on my own.&amp;nbsp; Apparently, I have worn y'all out with this one.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Sorry about that,&lt;BR&gt;Bill</description><pubDate>Thu, 26 Jun 2008 16:06:11 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17416.aspx</link><description>If your customer property work's fine with textbox's but not with a BBS then what does that tell you?</description><pubDate>Thu, 26 Jun 2008 15:58:59 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17415.aspx</link><description>[quote][b]Trent L. Taylor (06/26/2008)[/b][hr]Also, if you read Ivan's post, he has posted some code that shows an example of how to setup the basic structure of this custom property.&amp;nbsp; If you backup and start with his code, you are going to be a long way down the road.[/quote]&lt;/P&gt;&lt;P&gt;Were you able to review the code that I posted?&amp;nbsp; Other than the initialize and refilled code, I didn't think I was that far off.&amp;nbsp; Maybe I am.&lt;/P&gt;&lt;P&gt;At this point, I am just wanting a simple value to show up in the grid from a custom property.&amp;nbsp; Not even worried about filtering for now.</description><pubDate>Thu, 26 Jun 2008 15:54:00 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17414.aspx</link><description>&lt;IMG src="http://forum.strataframe.net/Uploads/Images/49d2beee-96be-4a97-a190-2bcb.JPG"&gt;&lt;/P&gt;&lt;P&gt;The three&amp;nbsp;columns (which are&amp;nbsp;blank)&amp;nbsp;are dragged from the available columns in the BBS to the layout of the grid.&amp;nbsp; All three are read-only custom properties that&amp;nbsp;return a constant (3, 2, 1, respectively; no complex logic, at all, per Greg).&amp;nbsp;&amp;nbsp; I have done nothing else.&lt;/P&gt;&lt;P&gt;You can see from my attached code earlier that I indeed have the proper ReflectionPropertyDescriptors set for each custom property.&amp;nbsp; Otherwise, these properties wouldn't even be seen by the grid design tool via the BBS.&lt;/P&gt;&lt;P&gt;I'll re-re-re-read everything, Trent.&amp;nbsp; I am not ignoring anyone's counsel.&amp;nbsp; I have acted on every part.&lt;/P&gt;&lt;P&gt;(I haven't found any towels, yet)&lt;BR&gt;Bill</description><pubDate>Thu, 26 Jun 2008 15:51:10 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17411.aspx</link><description>Also, if you read Ivan's post, he has posted some code that shows an example of how to setup the basic structure of this custom property.&amp;nbsp; If you backup and start with his code, you are going to be a long way down the road.</description><pubDate>Thu, 26 Jun 2008 15:40:57 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17410.aspx</link><description>BILL, if you would read my previous post, there is &lt;STRONG&gt;&lt;EM&gt;&lt;U&gt;ONLY&lt;/U&gt;&lt;/EM&gt;&lt;/STRONG&gt; one reason it would not show up in a grid through a BBS.&amp;nbsp; You are missing a property descriptor for the custom property...period!&lt;/P&gt;&lt;P&gt;You may be dealing with post and information overload, but this is not an overly complicated process or problem...when I run into something like this it is generally due to frustration and dealing with the same problem over a period of time.&amp;nbsp; There is a lot of good information in this thread...but first things first, I had posted explaining how to ensure the column always exists within the CurrentDataTable.&amp;nbsp; Secondly, I have told you the one and only reason why a custom property would not be visible through the BBS.&amp;nbsp; Please check and refer to these two points and I am sure that you will see where your problem is.</description><pubDate>Thu, 26 Jun 2008 15:38:09 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17409.aspx</link><description>Paul:&amp;nbsp; I have a very similar setup on my InvoiceBO with the [invoicetotal] field.&amp;nbsp; It is a custom property and displays nicely on a grid via a BBS.&amp;nbsp; I am mimicking much of what I did there within this current BO.&lt;/P&gt;&lt;P&gt;Greg:&amp;nbsp; I returned only a constant and the value still are not showing up in the grid.&amp;nbsp; Disturbing.&amp;nbsp; For some reason, as Paul is alluding to, the BBS is not picking up these values and passing them to the grid.&lt;/P&gt;&lt;P&gt;Guys...thanks for all of the help.&amp;nbsp; I am hitting the 24 hour mark on this current problem.&amp;nbsp; Hopefully, it will get resolved soon.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Btw, I have eliminated any column adding and filtering options...I need to get the data flowing first to the grid.&amp;nbsp; I will go from there once that is back in business.</description><pubDate>Thu, 26 Jun 2008 15:29:21 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17408.aspx</link><description>Bill,&lt;br&gt;
&lt;br&gt;
You might try doing something real simply like just returning a constant, bypassing all the code in you properties to see if that works. i.e. &lt;br&gt;
[codesnippet]       public decimal spxSalesOrderQty&lt;br&gt;
        {&lt;br&gt;
            get&lt;br&gt;
            {&lt;br&gt;
                // just skip the rest for now&lt;br&gt;
                return 1;&lt;br&gt;
&lt;br&gt;
                decimal mSOQty = 0;&lt;br&gt;
                ...rest of code untouched&lt;br&gt;
            }&lt;br&gt;
        }&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
If this works, then it has something to do with the property code. If it doesn't, then is has to do with the properties themselves or how the grid is using those properties.</description><pubDate>Thu, 26 Jun 2008 14:59:41 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17407.aspx</link><description>That is good, if it work's without the BBS then you know it is a BBS issue and not a business object issue. &lt;/P&gt;&lt;P&gt;What happens when you use a BBS is that it creates a new instance of the busines object for every row. However it does not carry over any custom properties etc that are&amp;nbsp;to the new instance.for instance if you have a property called foo in you business object and its value has been set to "Something" what the business binding source create a new instance of the Bo for that row the property foo's value with be nothing.&lt;/P&gt;&lt;P&gt;If that is what is happening then you can fix it by creating a BBS that is customized to your business object type. If you rthink this is where your problem is i can send you a copy of one&amp;nbsp;I modified.&lt;/P&gt;&lt;P&gt;Paul</description><pubDate>Thu, 26 Jun 2008 14:53:29 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17404.aspx</link><description>Hi Ivan,&lt;/P&gt;&lt;P&gt;Thanks for the input.&amp;nbsp; The only real difference is that my properties are read-only; therefore, no [i]set[/i] portion.&amp;nbsp; I have done exactly what you did...except I did not put the add column code in [i]both[/i] methods of the BO (initialize and refilled).&amp;nbsp; I will try that.&lt;/P&gt;&lt;P&gt;Bill</description><pubDate>Thu, 26 Jun 2008 14:37:52 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17402.aspx</link><description>With the textboxes, the values are showing up properly&amp;nbsp;as I navigate through the BO.&lt;/P&gt;&lt;P&gt;The grid has a BBS datasource that points to the exact same BO.&amp;nbsp; All of the fields in the grid are blank.&lt;/P&gt;&lt;P&gt;(preparing to look for a towel to throw in)</description><pubDate>Thu, 26 Jun 2008 14:20:47 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17401.aspx</link><description>Hey Bill.&lt;P&gt;Just in case it might help you see what Trent told you about adding a new field to your table and filtering on it, here is some code of mine where I do exactly the same, filtering on a field that doesn't exist on the underlying table.&lt;/P&gt;&lt;P&gt;On your BO:&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub MyBO_CurrentDataTableRefilled() Handles MyBase.CurrentDataTableRefilled&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Me.CurrentDataTable.Columns.Contains("myField") = False Then&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; Me.CurrentDataTable.Columns.Add("myField", System.Type.GetType("System.Boolean"))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub MyBO_CurrentDataTableInitialized() Handles MyBase.CurrentDataTableInitialized&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Me.CurrentDataTable.Columns.Contains("myField") = False Then&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; Me.CurrentDataTable.Columns.Add("myField", System.Type.GetType("System.Boolean"))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;BR&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;And, of course, the property:&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Browsable(False), _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BusinessFieldDisplayInEditor(), _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Description("My property"), _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)&amp;gt; _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Property [myFieldProperty]() As Boolean&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 loValue As Object&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; loValue = Me.CurrentRow.Item("myField")&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; If loValue Is DBNull.Value Then&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; Return False&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; Else&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; Return CBool(Me.CurrentRow.Item("myField"))&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; End If&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set(ByVal value As Boolean)&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; Me.CurrentRow.Item("myField") = value&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Set&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Property&lt;/P&gt;&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Protected Overrides Function GetCustomBindablePropertyDescriptors() As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Create and return a new array of FieldPropertyDescriptor&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' objects that contains the ReflectionPropertyDescriptor&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' for the cas_Idade field.&lt;BR&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; New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor("myFieldProperty", GetType(MyBO))}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;BR&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;So, now, on my logic, after setting my field depending on conditions:&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- applies the filter&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.MyBO1.Filter = "myField = True"&lt;BR&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;Hope it helps in some way...</description><pubDate>Thu, 26 Jun 2008 14:19:20 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17400.aspx</link><description>Bill,&lt;/P&gt;&lt;P&gt;Try taking the business binding source out of the equation, just throw a few text boxes on a form bound to your business object&amp;nbsp;custom properties&amp;nbsp; fill it and navigate through your record set and see if&amp;nbsp;it works. &lt;/P&gt;&lt;P&gt;The business binding source can create some serious&amp;nbsp;migraine style headaches as it creates a new instance of the business object for each row so some&amp;nbsp;things that have been set in the original BO are not longer "set" in the newly created bo.. Try it withough the BBS and see if your logic works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it works without the BBS in the middle then you can play doctor with the BBS source code and create a BBS specific to the business object you are binding to.&lt;/P&gt;&lt;P&gt;Paul</description><pubDate>Thu, 26 Jun 2008 14:05:26 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17399.aspx</link><description>Here is my actual custom property code.&amp;nbsp; Please criticize at will.&amp;nbsp; I have no other code reviewer here.&amp;nbsp; There has got to be something fundamentally wrong with what I am doing so that none of the custom properties values are showing up in a DevEx XtraGrid (via BBS).&amp;nbsp; I have done this with several other BOs so the process is not new to me.&amp;nbsp; &lt;/P&gt;&lt;P&gt;From these custom properties, I would like to filter the grid on the spxRequiredQty value.&amp;nbsp; Somehow, I have to tell the underlying table of the BO&amp;nbsp;that the column exists and what the data actually is (without resorting to stored procs and such).&amp;nbsp; &lt;/P&gt;&lt;P&gt;I know I am being difficult with this.&amp;nbsp; I have tried so many things that all of this is becoming a blur.&amp;nbsp; I have read through this thread several times, but just cannot see the light.&amp;nbsp; Thought I did a few times, but it was just that proverbial debug train coming at me through the tunnel of code exceptions.&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;P&gt;P.S. Still using SQL Server 2000.&amp;nbsp; :blush:</description><pubDate>Thu, 26 Jun 2008 14:05:22 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17398.aspx</link><description>One other point that I saw in regards to your grid...if you do not have a custom property descriptor setup, it will not show up in a grid.&amp;nbsp; You will need to override the GetCustomBindablePropertyDescriptors method on the BO and provide a ReflectionPropertyDescriptor.</description><pubDate>Thu, 26 Jun 2008 14:04:34 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17395.aspx</link><description>Bill,&lt;/P&gt;&lt;P&gt;I think that you are trying to make this too complicated.&amp;nbsp; I think that I would first backup and then start rethinking through your process.&lt;/P&gt;&lt;P&gt;First, we use custom columns as aggregates OR create a custom property that dynamically returns aggregates a lot.&amp;nbsp; Now since you are trying to apply a filter, then you will most likely want a column in the data table.&lt;/P&gt;&lt;P&gt;OK.&amp;nbsp; Since we have that established, from what I can understand, you always want to have a calculated column within your data table.&amp;nbsp; So obviously if you perform a query, then you can do this as part of the query (easier and faster in some cases).&amp;nbsp; However, if you will have a scenario that will not retrieve data from a database query first, then you would need to ensure that the column gets manually added prior to being refrenced or accessed.&amp;nbsp; So in this case, I would do one of two things to ensure that the column exists within the BO.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Override the OnAfterAddNew method of the BO and ensure that the desired columns get added within the BO and/or exist when a new record is added.&amp;nbsp; This way a query is not required, but when you add a new record the BO will ensure that the column exists.&lt;/LI&gt;&lt;LI&gt;Override the OnCurrentDataTableRefilled method of the BO and call the same logic that is added as part of the OnAfterAddNew method.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;By doing the above two things you will always be ensured that you have the column within your data table, thus allowing a filter to be applied.&lt;/P&gt;&lt;P&gt;At this point, you will just create the custom property on the BO to access it through the strong-typed reference, but you can then treat this column just as though you could any other column that comes from the database, however, it just resides within the BO.</description><pubDate>Thu, 26 Jun 2008 13:56:42 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17393.aspx</link><description>Some more thoughts (do I smell something burning?)....:P&lt;br&gt;
&lt;br&gt;
The second option is basically the first, just using a method to do the walking and loading, rather than the custom property...probably won't be any good in your situation either. I'd also try to find out why it takes so long...maybe there is something you could do to speed it up. Unless the data set is very large and/or the computation very complicated, this should be fast.&lt;br&gt;
&lt;br&gt;
For the third option, if you are using SQL Server 2005, consider a CLR sproc.  You program in the .NET language of choice (C# for you I believe) and they tend to be fast.  You likely could get a several minute process down to milliseconds. Search the forum for CLR stored procedures, there are some good posts about them by the SF team.  While I agree that placing code in BOs is the way to go, when I need speed for a data intensive process, I use SQL Server.  Now, sometimes, I can get the SQL Server joy AND put the code in the BO.  That command object can accept any sort of SQL.  I.e. you can do the work on SQL server but put the code (SQL script) in your BO.  This won't be as fast as a sproc (the execution plan isn't precompiled and cached on SQL Server), but might do the trick.&lt;br&gt;
&lt;br&gt;
If your custom properties aren't showing up, my first guess would be that you forgot to setup the custom property descriptors, but I'm still a newbie when it comes to grids so not sure if they are used in that case...  :(&lt;br&gt;
&lt;br&gt;
Good luck and remember to wear your fire retardant pants!  :w00t:</description><pubDate>Thu, 26 Jun 2008 13:41:14 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17392.aspx</link><description>Fascinating.&amp;nbsp; Bewildering.&amp;nbsp; Frustrating.&lt;/P&gt;&lt;P&gt;There are three custom properties and one additional column (for the filter).&amp;nbsp; Prop3 = Prop2 - Prop1 (basically), then ColumnA = Prop3.&amp;nbsp; Filter ColumnA so that only values greater than 0 are shown.&lt;/P&gt;&lt;P&gt;[quote]in your fill method, you could loop through the BO and fill the column by accessing the custom property[/quote]&lt;/P&gt;&lt;P&gt;Looping through the BO is very time consuming...several minutes to kerchunk each custom prop, then display the grid.&amp;nbsp; Not a good option.&amp;nbsp; In addition, the filter did not work even though the column has data!&amp;nbsp; It shows on the grid.&amp;nbsp; None of the custom properties show up on the grid...all blank still.&lt;/P&gt;&lt;P&gt;[quote]use a method that would fill that column (after adding it) (rather than using the custom property).[/quote]&lt;/P&gt;&lt;P&gt;That seems to only affect the first row of the BO.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Both of these last two options made the BO dirty.&amp;nbsp; Closing the window asked me if I want to save changes.&lt;/P&gt;&lt;P&gt;[quote]have SQL do the work and return that column[/quote]&lt;/P&gt;&lt;P&gt;This is an option (and I have done this for several other BOs)...but, the complexity of the stored procs and UDFs would make the process so slow and painful that it just isn't fun anymore.&amp;nbsp; Placing the complex code inside of custom class and/or business object really, really makes things a LOT easier (cleaner and neater, too).&amp;nbsp; &lt;/P&gt;&lt;P&gt;Well, back to the drawing board.&amp;nbsp; And, in the immortal words of Bill the Cat:&lt;/P&gt;&lt;P&gt;ACK!</description><pubDate>Thu, 26 Jun 2008 13:07:10 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I filter a business object by a custom property?</title><link>http://forum.strataframe.net/FindPost17391.aspx</link><description>The fire is already crackling loudly under my feet.&amp;nbsp; I'll go through those ideas in no particular order.&amp;nbsp; :)&lt;/P&gt;&lt;P&gt;Thanks a ton, Greg!&lt;BR&gt;Bill</description><pubDate>Thu, 26 Jun 2008 12:43:22 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item></channel></rss>