Displaying the record selection formula for a report

This example selects the first report it finds, prints its record selection formula, and then changes it.


<%

On Error Resume Next


'Retrieve InfoStore.

Set IStore = Session("IStore")


'Query for a report.

Set Result = IStore.Query("SELECT Top 1 SI_PROCESSINFO From CI_INFOOBJECTS Where " & _

    "SI_PROGID = 'CrystalEnterprise.Report'")

If (Err.Number <> 0) Then

    Response.Write "Example failed: try logging on first!<BR>"

End If


'Retrieve the first report returned.

Set ReportObject = Result.Item(1)



'Retrieve the report interface.

Set ReportInterface = ReportObject.PluginInterface

If (Err.Number <> 0) Then

    Response.Write "Example failed!<BR>"

End If


Response.Write "The record formula for this report is: "

Response.Write ReportInterface.RecordFormula    

Response.Write "<BR><BR>Changing the record formula...<BR>"


'The line below has been commented out to avoid altering any of your reports.

'Enter your formula value below.

'ReportInterface.RecordFormula = "{enter_formula_value_here}"


IStore.Commit Result

If Err.Number <> 0 Then

    Response.Write "The change was not successful."

Else

    Response.Write "The change was successful."

End If

%>





Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com