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!
|
|
How to pass in the currently logged in userid to crystal report in saleslogix web 7.5.1?
Posted: 19 May 09 5:30 PM
|
I have a report that I want to run for the currently logged in user with no prompting for parameters. I am trying to accomplish this using SalesLogix web client 7.5.1.
I tried adding the xml filter shown below in the XML Filter box of the Crystal Report Properties in Architect, but the report does not seem to even attempt to incorporate this filter in the report query based on what slx profiler tells me.
HISTORY ALL Query <table>History</table> USERID = :UserID
String
Ok - well, the forum is stripping out most of the xml. Basically I am adding the same xml that is generated for a condition if you click the Show XML button in the report edit conditions panel.
Is there a different/better approach that will work?
Thanks, Doug |
|
|
| |
| |
| |
| |
| |
|
Re: How to pass in the currently logged in userid to crystal report in saleslogix web 7.5.1?
Posted: 27 May 09 12:21 AM
|
A Sage rep has indicated to me that this appears to be a defect and they are looking into it.
I am intrigued by the advice to use the userid variable by asking the Slx Oledb Provider. This suggestion raises two questions for me: 1) how would one go about obtaining the currently-logged-in user from the Slx Oledb Provider and 2) how would one consult the Slx Oledb Provider within a Crystal Report? I may be misunderstanding the suggestion. |
|
|
| |
|
Re: How to pass in the currently logged in userid to crystal report in saleslogix web 7.5.1?
Posted: 10 Mar 10 7:25 AM
|
I have the solution, and it worked for SLX Web 7.2. It can be used to pass any, any value you want to the report, in a way some people could consider "ugly".
I will share this for people who want an easy way to implement the "User who printed the report" to satisfy a Customer Audit Policy.
Ok here is what i did: 1-Rename SLXWebReporting.aspx on C:\Program Files\SalesLogix\Web Components\slxwebrpt to SLXWebReporingV.aspx 2-Create a table on your SalesLogix installation called "ReporteMostrado" (it is in spanish because i'm latin) with 2 fields: REPORTE and USUARIO both VARCHAR2 let's say 200 size 3-Create a new SLXWebReporting.aspx (can be done in notepad) with the following: <%@ Page Language="C#" AutoEventWireup="true" Trace="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_PreRender(object sender, EventArgs e) { string rpt = Request["rpt"]; string User = Request["User"]; string Pwd = Request["Pwd"]; this.SqlDataSource1.DeleteCommand = "DELETE FROM REPORTEMOSTRADO WHERE REPORTE='" + rpt + "' AND USUARIO = (SELECT U.USERNAME FROM USERINFO U INNER JOIN USERSECURITY S ON U.USERID=S.USERID WHERE UPPER(S.USERCODE)='" + User + "')"; this.SqlDataSource1.Delete(); this.SqlDataSource1.InsertCommand= "INSERT INTO REPORTEMOSTRADO (REPORTE,USUARIO) VALUES ('" + rpt + "',(SELECT U.USERNAME FROM USERINFO U INNER JOIN USERSECURITY S ON U.USERID=S.USERID WHERE UPPER(S.USERCODE)='" + User + "'))"; this.SqlDataSource1.Insert(); Response.Redirect("SLXWebReportingV.aspx?rpt=" + rpt + "&User=" + User + "&Pwd=" + Pwd); } </script>
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Report Viewer</title> </head> <body> <form id="form1" runat="server"> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=SALESLOGIX; Persist Security Info=True;User ID=sysdba; Password=masterkey;Unicode=True" ProviderName="System.Data.OracleClient" SelectCommand="SELECT * FROM REPORTEMOSTRADO"> </asp:SqlDataSource> </form> </body> </html>
As you can see the string connection is for an Oracle installation. You should edit this for your specific instalation because as you can see, i'm editing the database directly.
4-Create a new report (i recommend this) or edit one you have, and add an unlinked reference to the "ReporteMostrado" table. Remember to use the SLX OLE DB provider. 5-Drop the "USUARIO" field from the "ReporteMostrado" table to any place on your report. 6-Create a formula called ReporteMostrado and place the following in the formula: "{" + Mid (Filename, InStr (1,Filename , "{")+1,InStr (1,Filename , "}")-InStr (1,Filename , "{")-1) + "}.rpt" 7-Add the following selection criteria to your report: {REPORTEMOSTRADO.REPORTE} = {@ReporteMostrado} 8-Do a Log Off from Database Server Current Connection (on Database menu), and save your report 9-Don't try to test it because it wont work at this stage. Open Architect.exe and Add your new report 10-Do an IISRESET
Ok, now, open your portal, lets say "http://slxserver:3333/slxclient" with any user you want and go to reports.
Search for your report and launch it.
Can you see the name? |
|
|
|