hello.
please look at the Image. How to formula the column by part1 and part2? thanks!
Hello psky,
Looking at your table I can see that you are referring to string columns. You could hook to the 'InitializeRow' event of the 'UltraGrid' and assign the string values of the corresponding cells to the formula cell:
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
e.Row.Cells[2].Value = e.Row.Cells[0].Value.ToString() + e.Row.Cells[1].Value.ToString();
}
Please feel free to let me know if a question about our tool set comes up on your mind.
psky,
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.
this is video file
this is the sample
Hi,Georgi,You are too powerful.thank you very much!
I met a new problem, how to call custom formula?
I'm calling a custom formula in the form of the LOAD event, but there will be mistakes.
private void frmFormula_Load(object sender, EventArgs e){ this.ultraGrid1.DisplayLayout.Bands[0].Columns["formula5"].Formula = "GroupByColumnSumFunction( [part12], [part4] )"; }
Thanks for the feedback.
The mentioned error is expected, because our custom formula "GroupByColumnSumFunction" does not exist in the CalcManager. So we need to add this custom function to the CalcManager. For example:
private void Form1_Load(object sender, EventArgs e)
MyCustomFunction custFunc = new MyCustomFunction(ultraGrid1.Rows);
ultraCalcManager1.RegisterUserDefinedFunction(custFunc);
ShowFormulaBuilderDialog_2(ultraGrid1.DisplayLayout.Bands[0].Columns["formula5"] as IFormulaProvider);
private void ShowFormulaBuilderDialog_2(IFormulaProvider formulaProvider)
FormulaBuilderDialog formulaBuilderDialog = new FormulaBuilderDialog(formulaProvider);
//formulaBuilderDialog.ShowDialog(this);
formulaProvider.Formula ="GroupByColumnSumFunction( [part12], [part4] )";
Please take a look at the modifications that I made in our sample and let me know if you have any questions.
Regards
Only you understand me, thank you for your hard work.
I found a new problem. Instance, if I according to field Part1 and part2, then the formula5 and. Formula does not recognize the complex formula.
Could I trouble you to look at how to modify it. The new formula is as follows:
Here is the sample
Hello Psky,
Sorry for the delay. You should make small modification in protected override Infragistics.Win.CalcEngine.UltraCalcValue Evaluate() method. I used our previous sample and I made changes in this method. Using a LINQ you could get desired results. For example:
var w = Rows.Where(z => z.Index <= gg && z.GetCellText(z.Band.Columns[0]) == FilterValue).Sum(s => Convert.ToDecimal(s.GetCellText(col)));
Please take a look at the attached sample for more details and let me know if you have any questions.
Hello,Georgi,
Where to go? Can you help me make a similar custom function?
Oh,I know.
can you help me to create a sample ?
[quote users="psky"] But the formula can't explain the multiple nested function. It is a pity![\quote] Please note that it is a custom function and I made this function only for one level of grouping. Using the same approach you could create function which supply two, three or more level of grouping
[quote users="psky"]The following summation, also can solve through the custom formula?[\quote] Yes, you could create your own function.