Solved

Why is the Crystal Reports 11 SQL expression system so retarded?

Posted on 2006-06-19
6
472 Views
Last Modified: 2011-09-16
I've got a simple report that has an SQL command, joins a couple of tables, groups, and prints. Now I want to add an SQL function call from the group. (E.g. call a scalar function from SQL with two parameters, display the result in each group.)

Seems simple enough, right? Well try as I might, I can't figure it out. The one option that might be able to do this for me, "SQL expression builder", disappears as soon as you add an SQL command in the database expert. WTF? Is it punishment for not wanting to use the lame Crystal reports database linkup system?

Any suggestions appreciated! I read to try a subreport, although have been resisting so far (I'm going to want to subtotal on this function call, etc). What I really want is a crystal reports function where I enter

"run my SQL function with parameters @go, @team", that I can use like any other Crystal function.
0
Comment
Question by:TerryBurger
6 Comments
 
LVL 26

Accepted Solution

by:
Kurt Reinhardt earned 250 total points
ID: 16941609
1)  A SQL Expression field is conceptually the same as a subquery/subselect (either correlated or uncorrelated) in the SELECT clause of the SQL statement that Crystal generates from your datasources.  Since you're using a SQL Command object, which is a SQL statement in it's own right (conceptually the same as a Stored Procedure that you create in Crystal instead of on the DB server) there is no need for a SQL Expression field.  After all, if you can write your own SQL in a command, why do you need to refer to another field object?

2)  Since a SQL Command object is treated as a Stored Procedure, it must be executed prior to any other objects in the report in order to identify the columns that are available to it.  As such, a SQL Expression field (which is a Crystal object) wouldn't do you any good because it wouldn't be evaluated until after the SQL Command.

3) I haven't tried this, but can you compile the scalar UDF in your DB then refer to it in the SELECT statement of your Command?  Then, you'd have the ability to group on the returned field.  If you're not able to do this, then I would try building the scalar UDF as a subquery in the SELECT statement of your command...

~Kurt

0
 
LVL 22

Assisted Solution

by:Ido Millet
Ido Millet earned 250 total points
ID: 16945541
One alternatve is to use a User Function Library (UFL).  At least one of the 3rd-party UFLs listed at: http://www.kenhamady.com/bookmarks.html provides functions that allow you to run SQL expressions that return a single value or that return no value (Update, Delete, Insert).  The target database can be any ODBC DSN (doesn't have to be the same as the main data source for the report).

- Ido
0
 

Expert Comment

by:smileymahoney
ID: 36550007
does anyone know if calling functions (as requested in the original question) has gotten any easier in Crystal 2008?
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 36550225
As far as I know it hasn't.

mlmcc
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now