Hi,
I need a bit of help with using formulas in summaries in the UltraWinGrid. I have a string column that can display, depending on the row, one of four things:
1. A decimal number in string form e.g. 1234.56
2. The string "<TO_RECALC>"
3. Another string e.g. "Incl", "Excl", etc
4. Nothing, i.e. empty string
I want to summary to show the following:
1. If all rows have a decimal number in that column then it will display the sum of those numbers. It will ignore empty string rows.
2. If any row has "<TO_RECALC>" in it, then the summary will display the same, no matter what values are in the other columns.
3. If all rows have the same string in them (no 3) then the summary will display that string, otherwise it will display '0'.
4. If all rows are empty string, then the summary will display empty string.
If anyone can giv e me an idea of how to do this using formulas, or possibly anything else, that would be fantastic!
Thanks,
Dane.
Thanks for your reply Mike. The custom calculator works well but now I have another related problem. I have a two or three level hierarchical grid. There is a column on each level called "Cost". The value of this cell in each row on each level should be the sum of the row's child rows' "Cost" values, with the last level being the values typed in.
For example:
A $100 (B+E)
--- B $40 (C+D)
------ C $10
------ D $30
--- E $60 (F+G+H)
------ F $15
------ G $20
------ H $25
I thought I would simply use summaries for these rows, then get the value of the summary and plug it into the parent row. The only problem is that I have to put these values in when the row is initialised, and at that point its children aren't initialised and the summaries don't add up properly. Any ideas on what I can do? Can i simply enter a formula in the parent columns saying =SUM(ChildRows("Cost")) or something like that?
Hi Dane,
I'm not sure I understand the problem. I assume that the last level has values in it already. So all you have to do is handle InitializeRow for the parent rows and get the SummaryValue on it's child rows collection. Are you saying that the SummaryValue doesn't have a value in InitializeRow? If it does not, you may have to force it by calling Summaries.Refresh.
Or, you might need to handle SummaryValueChanged in addition to InitializeRow.
If you want to use a Formula, I think there is a way to refer to the child rows of a particular row, but I don't know the syntax off the top of my head.