Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date Range Formula Post Reply Post New Topic
Author Message
hmmmmmm
Newbie
Newbie


Joined: 11 Dec 2010
Online Status: Offline
Posts: 7
Quote hmmmmmm Replybullet Topic: Date Range Formula
     Posted: 13 Dec 2010 at 8:23pm
{Command.Date}>= {?MyParameter} and {Command.Date} <= {My Parameter}

I Want to display record From and TO Date. For Example 03-12-2010 to 14-12-2010.

Above Said Formula For Date Range not Working. Any IDEA ?
IP IP Logged
JohnT
Groupie
Groupie
Avatar

Joined: 20 Jan 2008
Online Status: Offline
Posts: 92
Quote JohnT Replybullet Posted: 14 Dec 2010 at 3:39am
How are you entering your to and from date ?  It sounds like you want command.date >= from date and command.date <= to date.   In your formula, what is the value of "My Parameter" ?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Dec 2010 at 3:55am
i would guess as you have it written that you have one date param set to allow for a range input
{Command.Date} in Minimum({?MyParameter}) to Maximum({?MyParameter})
IP IP Logged
hmmmmmm
Newbie
Newbie


Joined: 11 Dec 2010
Online Status: Offline
Posts: 7
Quote hmmmmmm Replybullet Posted: 14 Dec 2010 at 7:20am
Originally posted by JohnT

How are you entering your to and from date ?  It sounds like you want command.date >= from date and command.date <= to date.   In your formula, what is the value of "My Parameter" ?



Page1:

From Date: TXTBOX1   To Date: TXTBOX2

BTNSUBMIT-CLICK
{
server.transfer("page2.aspx");
}


Page 2:

 if (PreviousPage != null)
        {
            TextBox txt1 = PreviousPage.FindControl("TXTBOX1") as TextBox;
            TextBox txt2 = PreviousPage.FindControl("TXTBOX2") as TextBox;


            if (txt1.Text.Length != 0 && txt2.Text.Length != 0)
            {

             ReportDocument cryRpt = new ReportDocument();
             cryRpt.Load("MyReport.rpt");

                ParameterFieldDefinitions crParameterFieldDefinitions;
                ParameterFieldDefinition crParameterFieldDefinition;
                ParameterValues crParameterValues = new ParameterValues();
                ParameterDiscreteValue crParameterDiscreteValue = new         
                ParameterDiscreteValue();

                crParameterDiscreteValue.Value = txt1.Text + txt2.Text;
                crParameterFieldDefinitions =
                cryRpt.DataDefinition.ParameterFields;
                crParameterFieldDefinition =
                crParameterFieldDefinitions["MyParameter"];
                crParameterValues = crParameterFieldDefinition.CurrentValues;

                crParameterValues.Clear();
                crParameterValues.Add(crParameterDiscreteValue);
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

                CrystalReportViewer1.ReportSource = cryRpt;

            }

         }


Formula In Formula Editor:

{Command.Date} >= {?MyParameter} and {Command.Date} <= {?MyParameter}





IP IP Logged
hmmmmmm
Newbie
Newbie


Joined: 11 Dec 2010
Online Status: Offline
Posts: 7
Quote hmmmmmm Replybullet Posted: 14 Dec 2010 at 7:25am
Originally posted by DBlank

i would guess as you have it written that you have one date param set to allow for a range



Should I use two parameters (i.e param1 & param2) in formula editor????
IP IP Logged
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