Hello,
I want to have a formula on a column where I refer to a parent band column. So I tried this:
e.Layout.Bands[0].Columns["freight"].Formula = @"[Band 0\extcost] * 0.02";
but I get #ref error. I tried the key name of the band too
@"[parts\extcost] * 0.02";
with no luck
I have other formulas where I refer from the parent band to the child band with no issue:
example
@"[Relation1\extcost] * 0.02";
What am i missing?
Hi,
I'm a little confused... you say you want to refer to the parent band, but the code you have here is applying a formula to a column in band 0, and band 0 is the root band, so there is no parent band.
Assuming that's just a typo and you really meant to use Band 1, then you would do it like this:
e.Layout.Bands[1].Columns["freight"].Formula = @"[../../extcost] * 0.02";
By the way... the way I figured this out (since I could not remember how to do it) was to create a new project with a grid and an UltraDataSource with 2 bands. Then I went into the formula builder for a column on the child band and double-clicked on a column in the parent band in the references tree. Then I just looked at the reference that the formula builder generated for me. :)
Yes it was a type and yes that is what I was looking for!
I didn't realize there was a formula builder. Where is that? In the same app where you can configure and style the grid?
Thanks.
I think you can get to it from the grid designer, as well. But what I did is bound the grid to an UltraDataSource at design-time. Then I went to the property grid in Visual Studio and went to:
DisplayLayout.Bands[1].Columns
This opens up the collection editor. Then I went to the Formula property of a column and there's an ellipsis button there which you can press to bring up the Formula Builder.