Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selection Formula.....

Status
Not open for further replies.

gonsales

Programmer
Oct 9, 2003
18
ES
Hi!.
I want to change the SelectionFormula of a report, but I couldn't do it!!!.
I've tried in two ways:
With reportViewer
.ReportSource = reportSource
.EnterpriseLogon = iStore.EnterpriseSession
.IsDisplayGroupTree=false
.IsOwnPage=true
.SelectionFormula="{Table.Id}=5"
.ProcessHttpRequest Request, Response,Session
End With

and:

Set result = iStore.Query("Select * from CI_INFOOBJECTS Where SI_ID=" & rptID)
set reportObject=result.item(1)
Set reportInterface = reportObject.PluginInterface("")
reportInterface.RecordFormula="{Table.Id}=5"
iStore.commit result

But I get the same result.....nothing has change
What's what I'm doing wrong??????
thanks!!
 
First of all modifying the selection formula in the viewer property will not help.
To modify the Group selection formula of a report you need to do something like this.

//************************************************

//Open the report Object

var oReportClientDoc = rptSrcFactory.OpenDocument(Number(GetSession("RptSrcID")));

var ObjFactory = Server.CreateObject("CrystalReports.ObjectFactory");

// Create new Filter object
var oFilter = ObjFactory.CreateObject("CrystalReports.Filter");
Response.Write(&quot;<br> Filter created&quot;);

oFilter.FreeEditingText = GF;
// Modify the record filter through the Record Filter Controller

oReportClientDoc.DataDefController.GroupFilterController.Modify(oFilter);
//Response.Write(&quot;<br> Final Filter applied&quot;);

viewer1.ReportSource = oReportClientDoc.ReportSource;
viewer1.IsOwnForm = true;
viewer1.IsOwnPage = true;
viewer1.IsDisplayGroupTree = false;
viewer1.PageToTreeRatio = 5.0;
viewer1.IsDisplayToolbar = true;
viewer1.IsDisplayPage = true;
viewer1.HasRefreshButton = true;


// Response.write (&quot;<br>&quot; + GetSession(&quot;RptSrcID&quot;));
// Response.Write(&quot;<br> Ready to process request&quot;);
viewer1.ProcessHttpRequest(Request, Response, Session );

//*******************************************************

Try something like this .. it works for me.
Nikhil
 
Thanks, but I get a &quot;Invalid Pointer&quot; error message when I assign
viewer.ReportSource = oReportClientDoc.reportSource


My code:
Set reportFactory = iStore.EnterpriseSession.Service (&quot;&quot;, &quot;RASReportFactory&quot;)
dim oReportClientDoc
dim oFilter
oReportClientDoc=reportFactory.OpenDocument(reportID)
oFilter=objectFactory.CreateObject(&quot;CrystalReports.Filter&quot;)
GF=&quot;{TB1.Id}=5&quot;
oFilter.FreeEditingText=GF
oReportClientDoc.DataDefController.GroupFilterController.Modify(oFilter)

Set reportViewer = objectFactory.CreateObject( &quot;CrystalReports.CrystalReportInteractiveViewer&quot; )
With reportViewer
.IsDisplayGroupTree=false
.IsOwnPage=true
.ReportSource = oReportClientDoc.reportSource
.EnterpriseLogon = iStore.EnterpriseSession
.URI = CStr( Request.ServerVariables.Item(&quot;PATH_INFO&quot;) & &quot;?&quot; & Request.ServerVariables.Item(&quot;QUERY_STRING&quot;))
End With
reportViewer.ProcessHttpRequest Request, Response, Session
 
Did you initialized objectFactory ???
i can not see it in your code.

Firse create a ObjectFactory Object and then use it.

Set ObjectFactory = Server.CreateObject(&quot;CrystalReports.ObjectFactory&quot;);

also try creating viewer as Server.CreateObject instade of

ObjectFactory.CreateObject.
I hope this should help.
 
My code:

Set objectFactory = Server.CreateObject(&quot;CrystalReports.ObjectFactory.2&quot;)
Set iStore = Session(&quot;iStore&quot;)
Set result = iStore.Query(&quot;Select SI_LAST_SUCCESSFUL_INSTANCE_ID From CI_INFOOBJECTS Where SI_NAME = '&quot; & targetReport & &quot;'&quot; & &quot; And SI_INSTANCE = 0&quot;)
reportID=result.Item(1).Properties.Item(&quot;SI_LAST_SUCCESSFUL_INSTANCE_ID&quot;)
Response.write &quot;<br> ID=&quot; & reportID

Set reportFactory = iStore.EnterpriseSession.Service (&quot;&quot;, &quot;RASReportFactory&quot;)
Set reportSource = reportFactory.OpenReportSource(reportID)

dim oReportClientDoc
dim oFilter
oReportClientDoc=reportFactory.OpenDocument(reportID)
oFilter=objectFactory.CreateObject(&quot;CrystalReports.Filter&quot;)
Response.Write (&quot;<br>Filtro Creado&quot;)
GF=&quot;{TB.Id}=5&quot;
oFilter.FreeEditingText=GF
oReportClientDoc.DataDefController.GroupFilterController.Modify(oFilter)

Set reportViewer = objectFactory.CreateObject( &quot;CrystalReports.CrystalReportInteractiveViewer&quot; )
With reportViewer
.IsDisplayGroupTree=false
.IsOwnPage=true
.ReportSource = oReportClientDoc.reportSource
.EnterpriseLogon = iStore.EnterpriseSession
.URI = CStr( Request.ServerVariables.Item(&quot;PATH_INFO&quot;) & &quot;?&quot; & Request.ServerVariables.Item(&quot;QUERY_STRING&quot;))
End With
reportViewer.ProcessHttpRequest Request, Response, Session

And I get &quot;Invalid pointer&quot; message error in line &quot;.ReportSource = oReportClientDoc.reportSource&quot;
What's wrong???
Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top