Link to home
Start Free TrialLog in
Avatar of qbjgqbjg
qbjgqbjgFlag for United States of America

asked on

crystal reports - dynamic parameter

I am adding a dynamic parameter to a report. I select a field for the value, then select a field for the description.  The problem I have is: When I run the report and select a parameter from mt list it brings in both the vale and the description. The value is a number, the description is a date. It pulls it in as 962 - 2013-05-25 00:00:00. Then gives me an error saying a number is required.
Avatar of Mike McCracken
Mike McCracken

Where are you using the parameter?

Can you show the formula?

I just built one the same way and don't have a problem
What version of Crystal?

mlmcc
Avatar of qbjgqbjg

ASKER

XI, The parameter is used in selection formula.
{ESGACTTR.ACCT_TYPE} = "E" and
({@dept} = {?Dept} or {?Dept} = '*') and
({@div} = {?Div}   or {?Div} = '*') and
({@act} = {?Act}   or {?Act} = '*') and
({@obj} = {?Obj}   or {?Obj} = '*') and
({@Fund} = {?Fund} or {?Fund} = '*') and
{ESGACTTR.ACCT_YEAR} = {?FiscalYear} and
{ESXTRANR.DOC_DATE} in {@DateBegin} to {@DateEnd} and
{CmdPayPer.PAY_PERIOD} = {?PayPeriod} and
{CmdPayPer.FISCAL_YEAR} = {?FiscalYear}
Which parameter?

Can you show a screen shot of the parameter edit screen?

mlmcc
I changed it a little. I tried making it a string. I hoped that would make  difference but it doesn't. It still makes the description part of the parameter. I have used dynamic before and it worked correctly. Is there a setting for this? Here is a screen shot of the definition and how it comes up.Doc1.docx
What data type is PayPeriod?

The parameter type is controlled by the field you choose.

Does it change the type when you choose the data field?

Try a verify database

mlmcc
In the original file it is numeric, so it automatically made it numeric and description is a date. I was using a sql command to select a subset of my table to use for the dynamic parameter. So I added 2 additional  fields, one for pay period changed to a string and 1 for the date with just the date(without the time). But neither way works. If I wanted it to bring in the description I would not know what to do to make it do that.This is the command
SELECT
 ESYPPERD.PAY_PERIOD
 , ESYPPERD.PAY_YEAR
 , ESYPPERD.END_DATE
 , ESYPPERD.START_DATE
 , ESYPPERD.CYCLE_CODE
 , ESYPPERD.FISCAL_YEAR
 , CONVERT(VARCHAR(10),ESYPPERD.END_DATE,110) as EndDate
 , CAST( ESYPPERD.PAY_PERIOD as VARCHAR(4)) as PayPeriod
 
 FROM   ESYPPERD ESYPPERD
 
 WHERE  ESYPPERD.CYCLE_CODE = 'b'
 AND ESYPPERD.FISCAL_YEAR =  {?FiscalYear}
AND ESYPPERD.END_DATE <= GETDATE()

ORDER BY
 ESYPPERD.START_DATE
,  ESYPPERD.PAY_PERIOD
Even if this had worked with the parameter I would have to convert it back to a number to use it in the report. I was just trying to see if being a string would make it work correctly. Here is the data pulled by the sql for the command. PayPeriods.xlsx
ASKER CERTIFIED SOLUTION
Avatar of qbjgqbjg
qbjgqbjg
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There was no solution, so I am going to do it another way.