Hi,
i'm not sure if i should be asking this but i'll give it a try and you can feel free to say "forget it"
is there a quick way to have the Band[0] be a summery of Band[1] (parent/child)? instead of me doing it manually for each column
part of the Band[1] columns are Text data and part of them are Numbers data (represented as strings)
at the moment i am binding a dataset that has 2 tables with DataRelation between them most of the columns are the same and visually i would like the band[0] cells will be the summery of the band[1] . but i dont care about the band[0] dataset wise , i only care about the band[1]
thanks
I'm afraid I do not understand what you are asking. What exactly are you trying to do?
It sounds like maybe you want to reverse the hierarchy and show Band 1 at the top and Band 0 under that. If that's what you want, then no, you cannot do that through the grid, but you could easily adjust the Relationship in your DataSource to go the other way.
thanks for the reply Mike,
i knew i will have a problem describing what i am after
no, im dont want to reverse the hierarchy,
most , lets say all, of my data is at Band[1] (childs) and i want that Band[0] (parent) will be summery of Band[1] (childs) for visual purpes only.
for example
parent 22 <- this is band 0
child 5 <- this is band 1
child 8 <- this is band 1
child 9 <- this is band 1
as there are Summery feature for UltraGrid so what i am after is like that Summery row but as Band[0] instead of at the bottom of the band[1]
also you can think of it as Band[0] to be summery of band[1]
Boris, thanks for the response ! you are all wonderful there at support.
currently i dont have VS2010 installed , but i will be sure to install it asap and check your samples and let you know :)
thank you again for this
Hello sharik,
Would you like me to create the sample with another version of Visual Studio. Simply tell which exactly and I will do it for you.
i was emberresed to request that, you guys at support do way too much for us users :)
VS2008
Infragistics 9.2
Winforms
No worries. I am glad to do it for you, that is why I am suggesting it - it would be faster for me to create the sample in Visual Studio 2008 then you installing it all the way from the bottom.
Please take a look at the project. I will be waiting for your feedback, I hope that this is what you are after, do not hesitate to ask otherwise.
yet again, thank you Boris .
i've reviewed the sample. it is close indeed to what i was looking for. after i've applied the SUM filter on the Band 1 it did put the summery at Band 0, but it put it ontop of the band 0. and i wanted the SUM value to be places as the cell value of band 0 on the same column. see picture(end of post) red arrow.
furthermore, i didnt want it the "Grand Summaries " text and the Total : 6 text to show . meaning all what was circuled in the green . instead the "1" should become "6"
finally, few of my columns are also pure text, and i wanted the "summery" to show all the child rows text (of a column) appended together into the father cell of the same column.
like this
parent -> Sunday, Monday, Tuesday
child -> Sunday
child -> Monday
child -> Tuesday
Now you can tell your self " are you kidding ? you are asking for too much" :) I know, this is somewhat (or not somewhat) a very specific behaviour i am after.... so i handled the summery by my self by looking at the running through the columns/rows and change the parent values to the SUM of the childS values of the same column. handling SUM if the columns has Numbers data or appending text if the columns hasText data.
yes that was some of the tweeking needed :) thanks
Removing the following foreach statement could help for this:
foreach (UltraGridCell cell in row.Cells)
So the code should become:
foreach (UltraGridRow row in e.Row.ChildBands["Band 1"].Rows) { //foreach (UltraGridCell cell in row.Cells) //{ switch (e.Row.Cells[0].Column.DataType.Name) { case "Decimal": { e.Row.Cells["Column 0 Band 0"].Value = int.Parse(row.Cells["Column 0 Band 1"].Value.ToString()) + int.Parse(e.Row.Cells["Column 0 Band 0"].Value.ToString()); break; } case "String": { e.Row.Cells["string"].Value = e.Row.Cells[0].Value.ToString() + ", " + e.Row.Cells["string"].Value.ToString(); break; } } //} }
foreach (UltraGridRow row in e.Row.ChildBands["Band 1"].Rows) { //foreach (UltraGridCell cell in row.Cells) //{ switch (e.Row.Cells[0].Column.DataType.Name) { case "Decimal": { e.Row.Cells["Column 0 Band 0"].Value = int.Parse(row.Cells["Column 0 Band 1"].Value.ToString()) + int.Parse(e.Row.Cells["Column 0 Band 0"].Value.ToString());
break; }
case "String": { e.Row.Cells["string"].Value = e.Row.Cells[0].Value.ToString() + ", " + e.Row.Cells["string"].Value.ToString();
break; } } //} }
Please do not hesitate to contact me if you need any additional assistance.
really great example !! but if i add another column of type Double and fill it with data then your code will summerize ALL child cells that are double, it does not focuse on the same column as the parent.
in my case the child columns are not exactly as parent columns
parent -> col1 col2 col3 decCol1 DecCol2 ....
child -> col1 decCol1 DecCol2 ....
when i tried it on my project it it had an offset of columns , meaning like the child summery value went into the wrong parent ( one to the left)
when i do it on the DataSet side and not the grid side , then it goes well.
thanks Boris :)
I tried to wrap up quickly a sample for you. I hope that it helps. Please let me know if there is something bothering you.
wow , that code indeed did it .... impressive .....as all your support ...
if there is a way to hide the summery icon/button and apply summery without needing the icon, then this will indeed be very usful for me.... i mean the summery feature.
as for the second, yes this will be strings and the grid is bound to dataset so as for "when" as it loads/binds then the data will be available so i would want it to show immidiately without expanding.
i dont need to summery icon/button to be available for the user, i want to do it all at code behind.
i am going to explore this feature now and understand how it can be done by code behind