cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting a Formula field into SQL Command

Former Member
0 Kudos

Hi, I currently have a crystal report that uses a Parameter field inserted as part of a SQL command.

However instead of relying on the user to enter the correct parameter I want to change this to a formula that is calculated in the report.

I tried replacing the parameter field with a formula but the SQL command then took no notice of the value.

How can I get the SQL to include a formula fields?

  1. Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Jason

I use Stored Procedures in SQL. First create the stored procedures and use where to condition the @XXX in crsytal report. Then use the store pro as the data source from the crsytal report.

Hope it can help.

Cheer

Gary

abhilash_kumar
Active Contributor
0 Kudos

Hi Jason,

When you say you've included the parameter field as part of the SQL Command, do you mean you've created a Command Object with a parameter? Or you've added the parameter field as part of the Record Selection Formula?

And, what formula did you add to the SQL Command?

-Abhilash

ido_millet
Active Contributor
0 Kudos

Since commands are data sources, they get executed before formulas are evaluated, so this won't work.  If you need to do data retrieval based on formulas in the report, you can use one of the following approaches:

  1. Subreport and formula info passed in as subreport links
  2. SQL Expressions
  3. At least one of the 3rd-party User Function Libraries (UFLs) listes at http://kenhamady.com/bookmarks.html allows a Crystal formula to trigger an SQL statement against an ODBC data source and return either single row value or multi-row (delimited) values.