Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Copper Contributor
Posts: 10
Registered: ‎04-21-2009

ShowReportUtil.js and Crystal Record Selection Formula

I wonder if anybody else has run into this.  I have a Crystal Report that I run from a button using ShowReport(ReportNameOrId, EntityTableName, EntityId).  The report has a recordselection formula that uses a prompt paremeter.  When I run the report, it ignores the EntityId parameter that I pass in and returns every record that matches the record selection formula.  If I remove the record selection formula, then the report returns just records for the EntityId that is passed in.  My question is, is this the way it's supposed to work, that you can't have a record selection formula AND pass an EntityId parameter?

Employee
Posts: 629
Registered: ‎04-24-2009

Re: ShowReportUtil.js and Crystal Record Selection Formula

The expectation is that the EntityId parameter info would be combined with the RecordSelectionForumula. Please open a ticket.

 

Thanks

 

Mike

Bronze Super Contributor
Posts: 141
Registered: ‎02-22-2010

Re: ShowReportUtil.js and Crystal Record Selection Formula

Hai Pormon,

I recently run through similiar kind of situation. I just found the following solution for the same.

If you have certain prompt parameters in the reports that needs to be dynamically pass paramters from your button click.

First step is Remove all the record selection formula from report.
Second ShowReport(ReportNameOrId, EntityTableName, EntityId) contains a function inside that called "populate Globals" which is reponsible for adding where clause to your query in the report. It will accept one entityid or multiple entity id's by concatinating them in to single string with comma seperator. If you want more parameters to parameters other than entityid just customize that function with new name and add more where clauses directly hardcoding in the populateglobals function and call that function in your ShowReport(ReportNameOrId, EntityTableName, EntityId). Also change the name of showReport to ShowReportNew(ReportNameOrId, EntityTableName, EntityId,NewParm1,Newparma2).....


Please let me know if this helps or just post the actual situation you are facing so that i will help you.



Thanks,
Jack.


Copper Contributor
Posts: 10
Registered: ‎04-21-2009

Re: ShowReportUtil.js and Crystal Record Selection Formula

Thanks Jack.  I'll try that.  I still need to prompt the user for additional parameters, but I suppose I could pop up a form with choices and build a sql statement from that.  But I'll also take Mike's advice and open a ticket just in case it is a defect.

Bronze Super Contributor
Posts: 141
Registered: ‎02-22-2010

Re: ShowReportUtil.js and Crystal Record Selection Formula

Hi pormon,

Does you make any progress on this. Curious to know how you resolve it? Please let us know...

Thanks,
Jack
Copper Contributor
Posts: 10
Registered: ‎04-21-2009

Re: ShowReportUtil.js and Crystal Record Selection Formula

Jack,

What I ended up doing was opening a smartpart in the dialogworkspace that has a listbox. The user selects one or multiple values and I use those to build a SQL where clause that I pass into a custom function that I created in ShowReportUtil.js.  In that function, I set the value of GLOBAL_REPORTING_WSQL to the SQL clause that I passed in.  It looks like this: GLOBAL_REPORTING_WSQL = (TICKET.ACCOUNTID = 'AAAAAA00000L')  AND (PICKLIST.TEXT = 'Scheduled').  If the user selects multiple values, then I add OR to the PICKLIST.TEXT part of the clause - I tried IN but it didn't work. 

It was pretty simple once you told me that I could change the GLOBAL_REPORTING_WSQL.

 

Peter

Silver Contributor
Posts: 835
Registered: ‎03-24-2009

Re: ShowReportUtil.js and Crystal Record Selection Formula

bottom line is there is no easy way to pass Parameters? I need to get some data to a sub report (History Date Range).....has nothing to do with the SQL Statement for the 'base' Crystal Report.......

 

I suppose I could write to the User Profile table and access the dates from UserDate1, UserDate2??? (the report is by user....this would be the user's desired dates.....)

RJ Samp
Employee
Posts: 629
Registered: ‎04-24-2009

Re: ShowReportUtil.js and Crystal Record Selection Formula

The only way to pass parameters in the way you require would be to create a custom report viewer.

 

Thanks

 

Mike