Logical loops in field expressions

  • Still on the report I've introduced in other threads, I want to make a total field which sums the values for the past twelve months (and another for the 24 months prior). I'm able to use the MonthField function I created in an earlier thread.

    I want to implement something along the lines of (I'm no VB programmer, so this is more pseudocode than real code):

    Dim Cursor As Integer

    Dim Total As Integer

    Total = 0

    While (Cursor = 1; Cursor < 13; Cursor++)
    (
    Total += Fields(MonthField(Cursor))
    )

    Return Total

    ----------

    I can't find a way to include a loop in the expression for a field. Since I also can't work out how to access fields from the Code tab, I can't put the formula there either.

    Any ideas?

  • Instead of Function you could use following expression in your report item:

    =Sum(Fields!FieldName.Value, "DataSetName")

  • And if you required Running Number Total then you can use:

    =RunningValue(Fields!FieldName.Value,SUM,Nothing)

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

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