cancel
Showing results for 
Search instead for 
Did you mean: 

Extract info from a "ranged" parm field

Former Member
0 Kudos

I want my users to be able to enter a range of dates in a Parameter field. I'm doing this by setting "allow range values" to True.

I would like to show the dates they entered on the report heading. Is it possible to extract them from the Parameter field?

Thanks in advance,

Doug

Accepted Solutions (1)

Accepted Solutions (1)

former_member260594
Active Contributor
0 Kudos

Doug,

Create a formula similar to the following;

stringvar b;

numbervar x;

for x:= 1 to ubound( {?MyDateRangeParameter} )

do

(

b:= b + totext( minimum ( {?MyDateRangeParameter} [x] )) + ' to ' + totext( maximum

( {?MyDateRangeParameter} [x] )) + chr( 13 )

);

b

This will loop through each range, convert it to text, add it to a string running total separating the beginning and end dates of each range with ' to ' and adding a carriage return to the end of each range. Ensure that the formula is set to Can Grow.

Former Member
0 Kudos

Thanks for your suggestion...

When I tried it, Crystal is not recognizing {?MyDateRangeParameter} as an array in the ubound function....

Any other ideas???

Former Member
0 Kudos

if it's any help, I'm only entering one range of dates, (fromdate todate)

Former Member
0 Kudos

Here are the formulas you need:

BeginDate = MINIMUM({?RangePrarmeter})

EndDate = MAXIMUM({?RangePrarmeter})

Hope this helps,

Jason

Former Member
0 Kudos

Your suggestion works if the range contains numbers, when I changed the field type to date, I received a "field can't be summarized" error.

Former Member
0 Kudos

You've got something going haywire. MINIMUM & MAXIMUM should on just about all field types. I know for a fact that it works on date time types.

Jason

Former Member
0 Kudos

We have a winner.

When I took the time to define the BeginDate and EndDate as date variables, Minimum and Maximum worked like a charm..

To recap:

-


datevar BeginDate;

datevar EndDate;

BeginDate = MINIMUM({?RangePrarmeter});

EndDate = MAXIMUM({?RangePrarmeter})

-


will allow you to retrieve the two dates entered as a range in a parameter field so they may be displayed in the report heading.

Thanks....

Former Member
0 Kudos

Glad you got it working.

Answers (0)