I'm using VS2008/VB/LINQ.
I'm using the flexGrid to create a quick report for management to check orders by grouping: Level1: Vendor Type, Level2: Product Line, Level3: Product Code, and Level4: Item. This is working great in most cases. But sometimes under Vendor Type, I only have one Product Line. At that point the tree doesn't provide Level 2 grouping, but does do the Level 3 Groupings. Is there a way to "force" it add a subtotal line at that point? I read an old post that indicated skipping the level was by design.
I am pretty sure what you want to do is relatively easy.
If you could post a sample here I would be happy to check it out and provide the details.
See attached file. thanks
Thanks for providing the data. I made a small sample based on it, it's attached.
As far as I can tell, the behavior is expected. I get this output:
ven1 lin1 f-1234 f-4444 lin2 g-1234 ven2 lin1 f-3423
The second vendor only has one line, so there's only one child node. I am not sure whether you are getting a different result (unlikey), or whether you expected something else (e.g. an empty "lin2"node under the second vendor).
If you wanted an empty node under the second vendor, you would have to write some code to insert it after the automatic subtotals have been calculated. If that is indeed the case, please confirm and I will be happy to show you the code.
Thanks
Bernardo,
Thanks for looking at this. I was called off to work on some other "hot" project for the past couple of days.
I'm attaching a screen view of the actual report. My manager is really excited about the report but hasn't had a chance to use it much. But I know that this will become an issue. I don't think it is an issue not to have a subtotal line for vendors without items (at this time there are only two but who knows what the future will bring), but it will probably be an issue not to have the vendor subtotal. I guess that inserting a node for the single vendor grouping would be similar to inserting a node for a non-existent vendor? In either case, I would appreciate viewing the code you mentioned.
Rose Anna
Sorry, I had forgotten the attachment. I hope this helps.
I think I finally understand the issue you are having. You want to use the grid as a report, and every vendor should appear in the report even if they have no product/item, correct? If that is the case, then the issue may be with the Linq statement you are using. It should include all vendors, even those with no items (the value in this case should be zero).
The data in your text file looked like this:
dt.Columns.Add("VendorType", typeof(string)); dt.Columns.Add("ProductLine", typeof(string)); dt.Columns.Add("ProductCode", typeof(string)); dt.Columns.Add("Item", typeof(string)); dt.Columns.Add("Qty", typeof(int)); dt.Columns.Add("Cost", typeof(double)); dt.Rows.Add("ven1", "lin1", "f-1234", "1234-kkk", 3, 500); dt.Rows.Add("ven1", "lin1", "f-4444", "1234-kkk", 8, 1000); dt.Rows.Add("ven1", "lin2", "g-1234", "1234-ggg", 2, 100); dt.Rows.Add("ven2", "lin1", "f-3423", "3423-kkk", 5, 50);
Perhaps it would work if the data looked like this instead:
dt.Rows.Add("ven1", "lin1", "f-1234", "1234-kkk", 3, 500); dt.Rows.Add("ven1", "lin1", "f-4444", "1234-kkk", 8, 1000); dt.Rows.Add("ven1", "lin2", "g-1234", "1234-ggg", 2, 100); dt.Rows.Add("ven2", "lin1", "f-3423", "3423-kkk", 5, 50); dt.Rows.Add("ven2", "lin2", "", "", 0, 0);
Hope this helps...