8/25/2025 6:30:26 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
problems with application.BasicFunctions.DoInvoke "CrystalReportPreview"
Posted: 09 Apr 07 5:52 PM
|
I need to run a report for only the current record and without using the Reports MainView...from a button, toolbar, etc.. My code is below. Basically, set two globals for field and value then launch the report using doinvoke. The report's when open script reads the globals and sets the filter; the When close clears the globals. It works exactly as intended... the first time. After that, it does nothing at all (until I reopen SLX). When I close SLX, it get a runtime error. I learned the hard way (working with Crystal in a .NET app) that it's a complete PITA to work with the Crystal objects... I'm pretty sure that an object is getting instantiated somewhere and then never released, but I don't know what, where, or how to fix it... Any advice would be much appreciated!
Code to invoke the report... Sub Button1Click(Sender) application.GlobalInfo.Add "RFilterField", "Account:AccountID" application.GlobalInfo.Add "RFilterValue", application.BasicFunctions.CurrentAccountID
application.BasicFunctions.DoInvoke "CrystalReportPreview", "Account:Account Summary - Sample" End Sub
Report's When Open script... option explicit sub Main
if application.BasicFunctions.GlobalInfoExists("RFilterField") then application.BasicFunctions.ReportClearConditions application.BasicFunctions.ReportAddCondition Application.BasicFunctions.GlobalInfoFor("RFilterField"), "=", Application.BasicFunctions.GlobalInfoFor("RFilterValue"), "string", vbNullString end if end sub
Report's When Close script... option explicit sub Main application.GlobalInfo.Delete("RFilterField") application.GlobalInfo.Delete("RFilterValue") end sub
|
|
|
|
Re: problems with application.BasicFunctions.DoInvoke "CrystalReportPreview"
Posted: 10 Apr 07 8:00 AM
|
John, You might try the "Application.BasicFunctions.PrintDetail" instruction without having to use a report When Open script. Since you are invoking a report which uses a main view table ("Account") it should work.
I have a similiar problem, but in my case, the table from which I wish to report on a single record is not a main table. The Print Detail instruction doesn't seem to work for such situations.
Bob Levine
|
|
|
|
Re: problems with application.BasicFunctions.DoInvoke "CrystalReportPreview"
Posted: 10 Apr 07 8:14 AM
|
Bob, does it work other than filtering for a single record?
The When Load script seems to be fine... If I use doinvoke to open the report (with or without the When Open script applying filters), it runs once, then will not run again until I close SLX...and it throws a runtime error when I close SLX.
edit.... I just looked at the PrintDetail function... I had no idea... What do you think they mean by "Caution: Reserved" in the documentation?
edit... I just tried it... same issue as doinvoke... runs once, but not again (this function does at least throw an error... "Error! Unable to print current view". throws runtime on SLX close.
John |
|
|
|
Re: problems with application.BasicFunctions.DoInvoke "CrystalReportPreview"
Posted: 10 Apr 07 8:21 AM
|
John, I think the "caution" relates to only working on reports which have the primary view tables (ie: Account, Contact, Opportunity) as their detail record sources.
I'm not sure why you are getting an error. What is the error? And to see what might happen, you could also try not using the When Close script.
Bob Levine
|
|
|
|
Re: problems with application.BasicFunctions.DoInvoke "CrystalReportPreview"
Posted: 10 Apr 07 8:27 AM
|
I'm going to try it on a different machine...hopefully it's just a problem with my Crystal install. I get the same problem using PrintDetail... it works once, then every time after that, no report and I get "Error! Unable to print current view" When I close SLX, I get the standard Windows "SalesLogix has ancountered a problem and needs to close..." and then "Runtime error 216 at 00404D4E" |
|
|
| |
| |
|
Re: problems with application.BasicFunctions.DoInvoke "CrystalReportPreview"
Posted: 15 Aug 08 5:35 AM
|
Hi John,
I get this exact problem on 3 of my 6 remote clients, and I have to somehow get the problem clients to work. I also had filters with global variables in the button code and initially thought that may have been the cause, but then to test I created a button called "cmdTest" and added the following code:
Sub cmdTestClick(Sender) Application.BasicFunctions.DoInvoke "CrystalReportPreview", "Opportunity:Sales Process Stage Analysis" End Sub
Even with this I still get the same problem. Second time I click the button nothing happens, and when I close SLX, I get the Windows error.
Any idea what we can do to get our problem clients to work?
Regards
Ina |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|