Conditional statements

  • I have a simple report that shows two columns of data: Order Type and Shares. In the report footer, I added a formula that says: =Sum(IIF(Fields!OrderType.Value = "Sell", 0, Fields!Shares.Value))

    My intent is to only sum up the non-sell orders. This doesn't seem to work for me. Then I created an additional column to the right of Shares. In this column I placed the following formula: =IIF(Fields!OrderType.Value = "Sell", 0, Fields!Shares.Value)). But that didn't work either. If the rows displays Sell  1000, the third column displays 1000 (when I would expect it to show 0). Any thoughts would be appreciated.

  • Is it possible you have spaces (or other chracters) in your 'Sell' string?  I would be temtped to do the VB.net equivalent of a LTRIM(RTRIM(....Value)) over the value to ensure that your Iif isn't being thwarted by some extra characters.

    Steve.

  • Good call. We noticed that after I posted this and it worked. You were right on the money though. Thanks!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply