Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: A question about Parameters that's a little messy Post Reply Post New Topic
Author Message
gguthrie
Newbie
Newbie


Joined: 06 May 2009
Location: United States
Online Status: Offline
Posts: 13
Quote gguthrie Replybullet Topic: A question about Parameters that's a little messy
    Posted: 06 May 2009 at 9:16am
I have 1 question that'll require multiple answers (I think), because I'm pretty lost on what to do. I'm using Visual Studio 2008 and crystal reports 10 (vb.net web application).
 
What I am trying to do is check the user who's logged in (I'm using .net users and roles)  and assign it as a parameter to a formula in my report. But I also have three parameters that I want the user to input.
 
Here's my code behind:
 
Partial Public Class reportstatus
    Inherits System.Web.UI.Page
    Dim myReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        configureCRYSTALREPORT()
        myReport.SetParameterValue("UserName", User.Identity)
    End Sub
    Private Sub configureCRYSTALREPORT()
        Dim myConnectionInfo As New ConnectionInfo()
        myConnectionInfo.DatabaseName = "CSi"
        myConnectionInfo.UserID = "*****"
        myConnectionInfo.Password = "*****"
        setDBLOGONforREPORT(myConnectionInfo)
    End Sub
    Private Sub setDBLOGONforREPORT(ByVal myconnectioninfo As ConnectionInfo)
        Dim mytableloginfos As New TableLogOnInfos()
        mytableloginfos = CrystalReportViewer1.LogOnInfo
        For Each myTableLogOnInfo As TableLogOnInfo In mytableloginfos
            myTableLogOnInfo.ConnectionInfo = myconnectioninfo
        Next
    End Sub
 
And here's my forumal I'm trying to get to work on my Crystal report:
 
{tblTireJobs.Status} = {?Status} AND {tblTireJobs.DateReported} >= {?StartDate} AND
{tblTireJobs.DateReported} <= {?EndDate} AND {aspnet_Users.UserId} = {?UserName}
 
Obviously when it asks for parameters it asks for all 4, including {?UserName}, which I don't want. I want it to take the value from my SetParameter value. 
 
sorry if this is a mess.
IP IP Logged
gguthrie
Newbie
Newbie


Joined: 06 May 2009
Location: United States
Online Status: Offline
Posts: 13
Quote gguthrie Replybullet Posted: 06 May 2009 at 12:03pm
This was a real vague question, so I'm going to try and clear it up (I am a newbie, sorry).
 
I am trying to display a report that only displays the results that the user has permission to see (I want multiple users access to this one report). The only way I can find out who is logged in is in the vb code of the .aspx page that houses the crystal report (I use User.Identity and I can assign that value to a parameter if needed).
 
Is there any way that I can get that user into either the sql query or the function part of the crystal report so I can run the report personalized for the user logged in?
IP IP Logged
gguthrie
Newbie
Newbie


Joined: 06 May 2009
Location: United States
Online Status: Offline
Posts: 13
Quote gguthrie Replybullet Posted: 06 May 2009 at 12:46pm
sorry this is in the wrong section. Can someone delete this? thanks!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.012 seconds.