Help & Support
Contents
Display Legacy Contents

Search:

Home > Report Designer > How-To Examples > Calculate each Row in the dataset

Calculate each Row in the dataset

Home > Report Designer > How-To Examples > Calculate each Row in the dataset

Calculate each Row in the dataset

At this time the act! OLE DB reader does not support immediate IIFs or case statements in the SQL select statement. A work around is to do the calculation post select. This can be done by manipulating and changing the values of the data set rows before the report is printed but after the select runs. To run custom scripting which allows you to adjust the returned values follow the steps below.

  1. Open the desired report in the Impact Report Designer
  2. Click o the TopMarginBand
  3. Expand the SCRIPTS property then click on (New)
  4. The Scripting Editor will open and you need to paste the code below.



Private Sub TopMarginBand_BeforePrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs)
For Each row As System.Data.DataRow In Sender.Report.DataSource.Tables(0).Rows
If NOT (row.Item("State") is DBNULL.Value)
Select Case row.Item("State")
Case "NY"
' Calculate . adjust values here
row.Item("State") = "New York"
End Select 
End If
Next row
End Sub




You will need to change "State" with one of your fields names in your select statement.

See also



Properties
Article ID:
calculate_each_row_in_the_dataset
Views: 185
Created By: jimdurkin
Modified By: [Modified By]
Created Date: 3/24/2014 12:31 PM
Last Modified: 3/24/2014 12:31 PM
Actions
Print This Article
Bookmark
Email This Article
Previous Article
Next Article