cancel
Showing results for 
Search instead for 
Did you mean: 

Can you use a formula field in a SQL command?

Former Member
0 Kudos

Crystal XI R2

I have a couple formula fields I'd like to use in my query. The formulas get their data from parsing a date parameter that allows a range.

Data is from an ADO connection to an SQL Server Database.

Under Database Expert, on Data Tab, under "Selected Tables" there is a command named "Command", which has my SQL. When I right click on that and choose "Edit Command" there are two input areas: "Enter SQL Query In the Box Below" and "Parameters list"

The command works as it is, now I want to use formula fields.

Is there a way to do that, e.g., can I refer to something like "@endDate" in my query, if my formula field is named "endDate"?

Thanks

I understand that might not be possible by design, becuase formulas might have changing values and the database query shouldn't keep re-running.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can pass the formula value to a command by using the subreport. Create a subreport using the command and create a command level parameter {?EndDate} and now from the main report try to link the Mainreport with the formula @EndDate to subreport command level parameter {?EndDate}.

Regards,

Raghavendra

Former Member
0 Kudos

Thank you, this solution worked.

Answers (0)