Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4165
How do I refer to parent band from child band in a formula?
posted

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?

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    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. :)

     

Children