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


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K 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 (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.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

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.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 (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 reputation)Advanced StrataFrame User (576 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 (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.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 (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K 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 (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.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 (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.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 (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K 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 (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.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.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search