cancel
Showing results for 
Search instead for 
Did you mean: 

Record Selection Formula

Former Member
0 Kudos

Hi Experts,

I am newbie in crystal report world Smile | :)

I need some help regarding creating record selection formulas:

1. How to filter records on the base of date [dd/mm/yyyy] range? The report will get two DATE parameters "fromDate" & "toDate". Can you please tell how to make this formula?

2. How to filter records on the base of time [mm:hh] range? The report will get two DATE parameters "fromTime" & "toTime". Can you please tell how to make this formula?

3. I have one parameter "CompanyName" which if user provides then the data should be selected for that specific company otherwise all companies data should appear. How to create this formula?

4. I want to create summary field which will be count of specific value lets say "XYZ" in some particular column of report. How to create such formula?

Accepted Solutions (0)

Answers (2)

Answers (2)

abhilash_kumar
Active Contributor

Hi Farhan,

1) The Record Selection formula will look something like this:

{Date_field} IN {?Parameter_Name}

2) The Record Selection formula will look something like this: 

Time{Date_Time_field} IN {?Parameter_Name}

3) You need an Optional Prompt and CR 2008 or above for this. In the Parameter Options, set the option 'Optional Prompt' to 'True'. The record selection formula would be:

Not(HasValue({?Parameter_Name})) OR {Company_Name_field} = {?Parameter_Name}

4) Create a formula with the code below and place it on the Details Section:

if {database_field} = "XYZ" then

{measure_field}

Go to Insert Summary > choose this formula field as the 'Field to Summarize' and place it on the Report Footer (Grand Total).

-Abhilash

Former Member
0 Kudos

Hi Farhan,

1) For this you just go to 'Report' menu --> selection formulas --> report -->Put the below formula there..

     "fromDate" > {Date field} AND  "toDate" < {Date field}

2) For time parameter you just go to 'Report' menu --> selection formulas --> report -->Put the below formula there..

      "fromTime" > {Time field} and "toTime" < {Time filed}

if would like to combine both formulas under one condition...

    (  "fromDate" > {Date field} AND  "toDate" < {Date field}) and ( "fromTime" > {Time field} and "toTime" < {Time filed})

3)you need to create a optional prompt for this requirement..

(not HasValue({?company Parameter}) OR {company field name} = {?company Parameter})

4)Right click on the field --> select 'Insert' --> select 'summuary' --> Specify the options for summary then you can get that count..

Hope this information will help you...

Thanks & regards,

Naga.