Article Details
Id:14830
Product:finPOWER Connect
Type:NEW
Version:3.00.08
Opened:21/08/2017
Closed:21/08/2017
Released:21/09/2017
Job: J019503

Report Templates; Scripting; ISGroupingItems; Added "Remove" method

Adding a custom grouping to a Report Template via code has been simplified by allowing items to be removed from an ISGroupingItems object.

For example, the following code would work but, if the Report was re-run via the button on the Report Preview form, the "Group" caption would be lost and replaced with "CustomGroup":

Select Case eventId
  Case "AfterParametersFinalise"
      If Not Parameters.GetGroupingItems("Groupings").Exists("CustomGroup") Then
        Parameters.GetGroupingItems("Groupings").Add("CustomGroup", False, "Group")
      End If
End Select

The following code avoids this issue:

Select Case eventId
  Case "AfterParametersFinalise"
    With Parameters.GetGroupingItems("Groupings")
      .Remove("CustomGroup")
      .Add("CustomGroup", False, "Group")        
    End With
End Select