I am trying to assign a value to a variable ("TaxCharge") using an Expression. The value is conditional, so I am using Switch(Condition,value...).
My code is:
Code: Select all
Switch(Products.Taxable > 0,Products.UnitPrice * Products.UnitsInStock * TaxRate,
Products.Taxable == 0,0)
; expected
Code: Select all
public virtual decimal TaxCharge
{
get
{
return Stimulsoft.Report.Dictionary.StiFunctionsProgrammingShortcut.Switch(Products.Taxable > 0.Products.UnitPrice * Products.UnitsInStock * TaxRate.
Products.Taxable == 0.0)m;
}
}
Code: Select all
{Switch(Products.Taxable > 0,Products.UnitPrice * Products.UnitsInStock * TaxRate,
Products.Taxable == 0,0)}
Am I doing something wrong?
I have attached an example with the expression field and the non-compiling "TaxCharge" variable. If you clear out "TaxCharge" you'll see the expression field works.
Thanks.