Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsReportsReportsUse address bar as parameter?Use address bar as parameter?
Previous
 
Next
New Post
2/4/2008 1:55 PM
 

Hi, This is the code I use to get parameter support. At the moment I must switch off friendly URLs in Host settings because I don’t yet know how to use NavigateURL. The changes are in App_Code\Reports\ReportsController.vb. This is for version 4.05 although it should work for 5 as well. 

Regards Jaco Vosloo

 
Original:

        Public Shared Function BuildParameters(ByVal SrcModule As PortalModuleBase) As DbParameter()

            Return New SqlParameter() {BuildIntParam("@PortalID", SrcModule.PortalId), BuildIntParam("@TabID", SrcModule.TabId), _

                BuildIntParam("@ModuleID", SrcModule.ModuleId), BuildIntParam("@UserID", SrcModule.UserId)}

        End Function
 
New:

        Public Shared Function BuildParameters(ByVal SrcModule As PortalModuleBase, ByVal Query As String) As DbParameter()

            Dim tmpParameterName As String

            Dim tmpArray As New ArrayList

            Dim IndexStart, IndexEnd As Integer

            IndexStart = Query.IndexOf("@", 0)
            Do While IndexStart >= 0
                IndexEnd = Query.IndexOf(" ", IndexStart)

                If IndexEnd < 0 Then IndexEnd = Query.Length

                tmpParameterName = Query.Substring(IndexStart + 1, IndexEnd - IndexStart - 1)

                tmpArray.Add(BuildParameter(SrcModule, tmpParameterName))

                IndexStart = Query.IndexOf("@", IndexEnd)
            Loop

            Return CType(tmpArray.ToArray(GetType(DbParameter)), DbParameter())

        End Function
 

        Private Shared Function BuildParameter(ByVal SrcModule As PortalModuleBase, ByVal ParameterName As String) As SqlParameter

            Dim tmpValue As String

            Dim tmpParameter As SqlParameter = Nothing

            Dim thisrequest As HttpRequest = HttpContext.Current.Request

            Dim AddBlankParameters As Boolean = True

            Select Case ParameterName

                Case "PortalID"

                    tmpParameter = BuildIntParam("@PortalID", SrcModule.PortalId)

                Case "TabID"

                    tmpParameter = BuildIntParam("@TabID", SrcModule.TabId)

                Case "ModuleID"

                    tmpParameter = BuildIntParam("@ModuleID", SrcModule.ModuleId)

                Case "UserID"

                    tmpParameter = BuildIntParam("@UserID", SrcModule.UserId)

                Case Else

                    tmpValue = thisrequest.Params(ParameterName)

                    If AddBlankParameters Or Not (tmpValue Is Nothing Or tmpValue = "") Then

                        tmpParameter = New SqlParameter("@" + ParameterName, tmpValue)

                    End If

            End Select

            Return tmpParameter

        End Function
 
New Post
2/4/2008 3:47 PM
 

Very cool, thanks for posting that! As I said, I hope to have a parameter system in the next version but that's a nice little work around.


Andrew Nurse
DotNetNuke Core Team Member and Reports Module Project Lead
Microsoft Certified Professional Developer

 
New Post
2/16/2008 4:24 PM
 

Hi,

Just want to come up with an idea for this.

You can use a user defined table to set some parameters, since the report can join from the UDT to get its parameters.

It may not be as dynamic as you need to, but this may be a usefull trick for others as well.

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsReportsReportsUse address bar as parameter?Use address bar as parameter?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out