Results 1 to 5 of 5

Thread: Display in crystal report values inputted by user [RESOLVED]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    145

    Display in crystal report values inputted by user [RESOLVED]

    Hi all,

    In my form, I am passing range of values to be passed to a dataset as recordsource to my crystal report.

    In my report, I wanted to get those range of values (date) and display them.

    For example, if the user inputs
    From date : 09/15/2003
    To date : 09/30/2003

    I want those values displayed in my report.

    How can I do that?

    Many thanks.
    Last edited by Marivic; Sep 17th, 2003 at 01:01 AM.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    145

    Display in crystal report values inputted by user[RESOLVED]

    For those who are interested:

    I used the parameter collection and passed them to crystal.

  3. #3
    Lively Member
    Join Date
    Jul 2003
    Posts
    93
    Marivic,
    Can you post how you did that? I'm trying to do the same thing & struggling to figure it out.

    Thanks

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    145
    First, in your crystal report, define the parameter that would accept the value you are passing.

    then in your code:

    Code:
    ' Objects used to set the parameters in the report
                Dim pvCollection As New ParameterValues()
                Dim pdvFromDate As New ParameterDiscreteValue()
                Dim pdvToDate As New ParameterDiscreteValue()
    
                ' Set the discreet value 
                pdvFromDate.Value = dtpfrom.Value.ToShortDateString
                pdvToDate.Value = dtpto.Value.ToShortDateString
    
                ' Add it to the parameter collection.
                pvCollection.Add(pdvFromDate)
                pvCollection.Add(pdvToDate)
    
                oRpt.DataDefinition.ParameterFields("@fromdate").ApplyCurrentValues(pvCollection)
                oRpt.DataDefinition.ParameterFields("@todate").ApplyCurrentValues(pvCollection)
    HTH

  5. #5
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    I get an invalid field name errror on this line:

    VB Code:
    1. rpt.DataDefinition.ParameterFields("@beginDate").ApplyCurrentValues(pvCollection)

    I changed the code around little bit.


    VB Code:
    1. Dim pvCollection As New ParameterValues()
    2.         Dim pdvFromDate As New ParameterDiscreteValue()
    3.         Dim pdvToDate As New ParameterDiscreteValue()
    4.  
    5.         ' Set the discreet value
    6.         pdvFromDate.Value = tranPeriodEnd.ToShortDateString
    7.         pdvToDate.Value = tranPeriod.ToShortDateString
    8.  
    9.         ' Add it to the parameter collection.
    10.         pvCollection.Add(pdvFromDate)
    11.         pvCollection.Add(pdvToDate)
    12.  
    13.         rpt.DataDefinition.ParameterFields("@beginDate").ApplyCurrentValues(pvCollection)
    14.         rpt.DataDefinition.ParameterFields("@endDate").ApplyCurrentValues(pvCollection)
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width