How do I filter a business object by a custom property?


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
When I attempt to filter a BO on a custom property, the debugger tells that the specified column does not exist.  It is true that it cannot be found in the DB, but it is on the BO.  Is there a trick to filtering on a custom property?

Thanks,
Bill

Replies
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Bill,



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.

public decimal spxSalesOrderQty

{

get

{

// just skip the rest for now

return 1;



decimal mSOQty = 0;

...rest of code untouched

}

}





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.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Paul:  I have a very similar setup on my InvoiceBO with the [invoicetotal] field.  It is a custom property and displays nicely on a grid via a BBS.  I am mimicking much of what I did there within this current BO.

Greg:  I returned only a constant and the value still are not showing up in the grid.  Disturbing.  For some reason, as Paul is alluding to, the BBS is not picking up these values and passing them to the grid.

Guys...thanks for all of the help.  I am hitting the 24 hour mark on this current problem.  Hopefully, it will get resolved soon. 

Btw, I have eliminated any column adding and filtering options...I need to get the data flowing first to the grid.  I will go from there once that is back in business.

Trent Taylor
Trent Taylor
StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
BILL, if you would read my previous post, there is ONLY one reason it would not show up in a grid through a BBS.  You are missing a property descriptor for the custom property...period!

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.  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.  Secondly, I have told you the one and only reason why a custom property would not be visible through the BBS.  Please check and refer to these two points and I am sure that you will see where your problem is.

Trent Taylor
Trent Taylor
StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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.  If you backup and start with his code, you are going to be a long way down the road.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Trent L. Taylor (06/26/2008)
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.  If you backup and start with his code, you are going to be a long way down the road.

Were you able to review the code that I posted?  Other than the initialize and refilled code, I didn't think I was that far off.  Maybe I am.

At this point, I am just wanting a simple value to show up in the grid from a custom property.  Not even worried about filtering for now.

Paul Chase
Paul Chase
Advanced StrataFrame User (542 reputation)Advanced StrataFrame User (542 reputation)Advanced StrataFrame User (542 reputation)Advanced StrataFrame User (542 reputation)Advanced StrataFrame User (542 reputation)Advanced StrataFrame User (542 reputation)Advanced StrataFrame User (542 reputation)Advanced StrataFrame User (542 reputation)Advanced StrataFrame User (542 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
If your customer property work's fine with textbox's but not with a BBS then what does that tell you?
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Paul Chase (06/26/2008)
If your customer property work's fine with textbox's but not with a BBS then what does that tell you?

I am focusing on the BBS, as mentioned in an earlier post (following Greg's suggestion to return a constant).  My biggest issue is why the code works for one grid and not another.  Both have BOs with custom properties flowing through a BBS to the grid.

I'll continue to grind it out on my own.  Apparently, I have worn y'all out with this one. 

Sorry about that,
Bill

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hey Bill.

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?

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Thanks for reviewing the code, Ivan.  Yup, just left it out, since I am replacing it with the newer properties that I shared with you.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I thought I would try to wrap up this thread with a play-by-play of what I did to solve the problem.  Thanks everyone for all of the help!


1)  Added code to the CurrentDataTableInitialized and CurrentDataTableRefilled (per Trent and Ivan)

if (CurrentDataTable.Columns["spxInventoryQty"] == null) { CurrentDataTable.Columns.Add(new DataColumn("spxInventoryQty", typeof(decimal))); }

2)  Altered the custom property to a basic structure (no reference to the new column)

[<snipped>]
public decimal InventoryQty
{
   
get
   
{
       
decimal mInvQty = 0;
       
// calculate the amount on hand (pending)
       
mInvQty = this.onhandqty; // use the invalid value for now (for testing)
       
return mInvQty;
    }
}

3)  Filled the BO that applies a similar filter to what I wanted in the BO (removed that part of the problem entirely)

4)  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 stayed empty)

private void SetColumnValues()
{
   
foreach (PartsBO mBO in partsBO1.GetEnumerable())
    {
        partsBO1.CurrentDataTable.Rows[partsBO1.CurrentRowIndex][
"spxInventoryQty"] = partsBO1.InventoryQty;
    }
}

5)  Create a dataset from the CurrentDataTable(s) to be the data source for the DevEx Grid (necessary for the master/detail gridviews, BBS bypassed)

DataSet ds = new DataSet();
ds.Tables.Add(partsBO1.CurrentDataTable);
ds.Tables.Add(salesOrderDetailsBO1.CurrentDataTable);
ds.Relations.Add(
"SalesOrders", ds.Tables[0].Columns["partindex"], ds.Tables[1].Columns["partindex"], false);
PartsGridControl.DataSource = ds.Tables[0];
PartsGridControl.LevelTree.Nodes.Add(
"SalesOrders", SalesOrderView);
PartsGridControl.RefreshDataSource();


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 window.  I will do some searching on how to prevent saves in this situation.  I am sure it has been covered in the docs or other forum entries.  The secondary one is that the lookup data in the related sales order grid (e.g. customer name, unit description, etc.) is always empty.  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.

Thanks, again, for everyone's help!  Naturally, if anyone sees something that may help me improve things, feel free to let me know.

Have a great day!
Bill

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Glad you got it going, Bill! Wink

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 window.

Not sure this is the recommended way, I'm sure you will be adviced against it if not. Have you tryed issuing a SAVE right after you modifiy all your custom field values? This is what I'm doing, anyway! Smile

As this column is not part of your table, nothing will happen to it, I suppose.

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Since the form's purpose is to display information only, I set the AutoShowSaveChangesMessage on the maintenance form to 'false.'  That took care of it.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K

The three columns (which are blank) are dragged from the available columns in the BBS to the layout of the grid.  All three are read-only custom properties that return a constant (3, 2, 1, respectively; no complex logic, at all, per Greg).   I have done nothing else.

You can see from my attached code earlier that I indeed have the proper ReflectionPropertyDescriptors set for each custom property.  Otherwise, these properties wouldn't even be seen by the grid design tool via the BBS.

I'll re-re-re-read everything, Trent.  I am not ignoring anyone's counsel.  I have acted on every part.

(I haven't found any towels, yet)
Bill

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Bill Cunnien - 16 Years Ago
Trent L. Taylor - 16 Years Ago
Bill Cunnien - 16 Years Ago
Greg McGuffey - 16 Years Ago
Bill Cunnien - 16 Years Ago
                         A custom property shows up in the field list when creating a browse...
Bill Cunnien - 16 Years Ago
Peter Jones - 16 Years Ago
Bill Cunnien - 16 Years Ago
Greg McGuffey - 16 Years Ago
Bill Cunnien - 16 Years Ago
                 Guys, can I do this? foreach ( DataRow dr in this...
Bill Cunnien - 16 Years Ago
Trent L. Taylor - 16 Years Ago
Peter Jones - 16 Years Ago
Bill Cunnien - 16 Years Ago
Charles R Hankey - 16 Years Ago
Trent L. Taylor - 16 Years Ago
Bill Cunnien - 16 Years Ago
Trent L. Taylor - 16 Years Ago
Trent L. Taylor - 16 Years Ago
                         [quote]Thanks for pulling out the French. English just wasn't getting...
Greg McGuffey - 16 Years Ago
Bill Cunnien - 16 Years Ago
Trent L. Taylor - 16 Years Ago
                         Thanks, Trent! Man, I am getting tired...past midnight here. Still...
Bill Cunnien - 16 Years Ago
                             I added the code below into the CurrentDataTableRefilled method:...
Bill Cunnien - 16 Years Ago
                                 If I put a break on the first line of the code in the custom property,...
Bill Cunnien - 16 Years Ago
                                     Well, you need to have data in the colReqQty for the filter to work,...
Greg McGuffey - 16 Years Ago
                                         The fire is already crackling loudly under my feet. I'll go through...
Bill Cunnien - 16 Years Ago
                                         Fascinating. Bewildering. Frustrating. There are three custom...
Bill Cunnien - 16 Years Ago
                                             Some more thoughts (do I smell something burning?)....:P
...
Greg McGuffey - 16 Years Ago
                                                 Bill, I think that you are trying to make this too complicated. I...
Trent L. Taylor - 16 Years Ago
                                                     One other point that I saw in regards to your grid...if you do not...
Trent L. Taylor - 16 Years Ago
                                                 Here is my actual custom property code. Please criticize at will. I...
Bill Cunnien - 16 Years Ago
                                                     Hey Bill. Just in case it might help you see what Trent told you about...
Ivan George Borges - 16 Years Ago
                                                     Bill,

You might try doing something real simply like just...
Greg McGuffey - 16 Years Ago
                                                         Paul: I have a very similar setup on my InvoiceBO with the...
Bill Cunnien - 16 Years Ago
                                                             BILL, if you would read my previous post, there is ONLY one...
Trent L. Taylor - 16 Years Ago
                                                                 Also, if you read Ivan's post, he has posted some code that shows an...
Trent L. Taylor - 16 Years Ago
                                                                     [quote][b]Trent L. Taylor (06/26/2008)[/b][hr]Also, if you read Ivan's...
Bill Cunnien - 16 Years Ago
                                                                         If your customer property work's fine with textbox's but not with a...
Paul Chase - 16 Years Ago
                                                                             [quote][b]Paul Chase (06/26/2008)[/b][hr]If your customer property...
Bill Cunnien - 16 Years Ago
                                                                         Hey Bill. Don't even know wether this would make a difference or not,...
Ivan George Borges - 16 Years Ago
                                                                             Thanks for reviewing the code, Ivan. Yup, just left it out, since I am...
Bill Cunnien - 16 Years Ago
                                                                                 I thought I would try to wrap up this thread with a play-by-play of...
Bill Cunnien - 16 Years Ago
                                                                                     Glad you got it going, Bill! ;) [quote]There are a couple of...
Ivan George Borges - 16 Years Ago
                                                                                         Since the form's purpose is to display information only, I set the...
Bill Cunnien - 16 Years Ago
                                                                 The threecolumns (which areblank)are dragged from the available...
Bill Cunnien - 16 Years Ago
                                                 Bill, Try taking the business binding source out of the equation,...
Paul Chase - 16 Years Ago
                                                     With the textboxes, the values are showing up properlyas I navigate...
Bill Cunnien - 16 Years Ago
                                                         Hi Ivan, Thanks for the input. The only real difference is that my...
Bill Cunnien - 16 Years Ago
                                                             That is good, if it work's without the BBS then you know it is a BBS...
Paul Chase - 16 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search