Login / Register  search  syndication  about

          Jason Buss' Blog

Jason Buss on SalesLogix development & customization, SQL, and more.

Setting conditions for Crystal Reports in SalesLogix LAN

I wanted to quickly outline a process for passing a condition to a Crystal report in two simple steps.  Say you've created an account report that you want to launch via a button on the account detail, limited to the current account record.

Step 1, Setting up the button:

The button is going to do two things:  Set the current accountid to a global variable, and launch the report.

Sub Button1Click(Sender)
    Application.BasicFunctions.GlobalInfoSet "gAccountID", Application.BasicFunctions.CurrentAccountID
    Application.BasicFunctions.DoInvoke "CrystalReportPreview", "Account:New Account Report"
End Sub

Step 2, pass the current ID to the launched report:

In order to pass the ID to the report, we need to create a VB Script which grabs the Global Variable, then passes it to the report using the ReportAddCondition function found under Application.BasicFunctions.  This script is attached to the report via the report properties set under manage|Crystal Reports.

The new script is named Account Report Add Condition, and contains:

Sub Main
Dim AccID

    AccID = Application.BasicFunctions.GlobalInfoFor("gAccountID")
    Application.BasicFunctions.ReportAddCondition "AccountID", "=", AccID, "String", ""
    Application.BasicFunctions.GlobalInfoClear "gAccountID")

end sub

Three things are happening here.  First of all, we're assigning a local variable to the ID contained in the Global Variable.  Next, we add the condition to the report, and finally, we clear the global variable.  Once the script is saved, go to the menu item "Manage|Reports", select the report you want to add the condition to and view the properties of the report.  On the Execution tab, add the script to the When Open event.

 

That's all there is to it!  You now have a button on account detail which launches your new report for the current opportunity record.

What's This?
  
Bookmark and Share

About Jason Buss

   Jason is a senior application developer with Customer FX.



Related Content
   Telnet Sample to Send an SMTP email
I am always forgetting how to test sending an email through an SMTP gateway using the Telnet client. 
Posted on Dec 12, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Problem setting SLXTextbox enabled property / Setting unexposed base control properties for a custom control
I recently had an issue with a Quickform where I was attempting to set the Enabled property of a TextBox
Posted on Dec 05, 2014 by Jason Buss to Jason Buss' Blog
 
   Confirming Actions With an "Are you sure?" Prompt in Infor CRM (Saleslogix)
I'm not a huge fan of bugging end users. I figure, if an end user clicked something, he or she meant
Posted on Nov 18, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Adding a report link to the Common Tasks pane in Infor CRM (formerly Saleslogix)
When you are viewing an Entity Detail page, the Common Tasks pane on the right of the page provides a nu
Posted on Nov 12, 2014 by Jason Buss to Jason Buss' Blog
 
   Problem with the Clean Build Folders option in Application Architect
On occasion, it becomes necessary to clean out the build folders and deployed website prior to a build/de
Posted on Sep 16, 2014 by Jason Buss to Jason Buss' Blog
 
Comments

 

Mike Douglas said:

Hi

Been doing similar for some years in slx 62. Hit an issue when you get 72 and beyond. Whilst the above still work fine for a report called from a button, the script does not run for reports called from the normal reports menu system within LAN. Which is a major pain. Just doing an upgrade at present and a lot of the reports have code which would run on OnOpen

June 26, 2009 7:45 AM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2014 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register