Photo via psanford
How can I add the user who printed a report to a custom report I added to the menu in Sage MAS 90 / 200?
In order to print the User ID on any Crystal Report being run from the MAS 90 menu, you have to create a new formula in the Crystal Report named PrintedByUser. Using Basic Syntax the formula would be: Formula=””’ (and using Crystal Syntax would be: “”).
You can use this tip on custom reports for both business framework modules and legacy modules.
There are number of variables that MAS 90 passes through to Crystal Reports that are run from within MAS 90 and can be used in the same manner:
CompanyNameCode (CompanyName + CompanyCode)
That’s great, but I want the user name on my custom report.
OK, that’s a little trickier. You still need to create the PrintedByUser field as above, however to get the user name you’re going to need to create a subreport.
Creating a Subreport to Add the User Name to a Custom Report
You have to use a subreport because you’re going to have to join the SY_User table by the PrintedByUser formula field you created.
From the Crystal Report, go to Insert | Subreport.
Create a name in New Report Name; I’m calling mine UserNameSub and click Report Wizard.
Using the Report Wizard you’re going to create a new report based on the SY_User table. Add the First Name and the Last Name to the subreport and click Finish.
On the Link tab, select the PrintedByUser formula as the field to link by and from the dropdown select UserLogon. Click OK.
Drop the subreport on your main report.
Now for a little cleanup. Right click the subreport and select Edit Subreport. I’d suggest suppressing any Headers or Footers in the subreport and if you want instead of having the FirstName and LastName fields, you can create a formula combining the two into one field.
Close the Subreport and save your report and run from the MAS 90 menu and you should get the user name on your report.
© 2011 – 2012, Robert Wood. All rights reserved.