Crystal Reports doesn't seem to have a SQL Expression Editor. I know the Editor is only available when I select tables from source, so how can I add my own SQL Expression to my report?
To write your own SQL expression within Crystal, go to the Field Explorer on the right side of the Design view. Right click Database Fields and select Database Expert.
Pick the matching connection you want to use, and select Add Command
From here on out, Crystal will treat your statement as if it was another existing table.
Related
Any idea how to repeat same value in crystal report designer instead of increment.
Using Field Explorer in Visual Studio
Expand the Database Fields and find the column name to display.
Drag the select column into the designer.
Right click on the column and use copy paste feature.
I am trying to debug missing data in an existing report.
I see the database it is connected to, but I do not find any table or stored procedure or view in that database with the same name that I see in the record selection part of the Crystal Report.
Is there a way to find which table/view/stored procedure is used as input for the Crystal Report?
Thank you
Never mind. I found it. Rt click on Database Fields and select Set Datasource location...
You need to set up first what type of connection you need.
This will help you using ODBC connection.
Ideally you can set this when first time confiugre the data, but suppose if you update the table or procedure and that will not impacted in your crystal report.
To update the updated db element / object in crystal report, simply "Update datasource" option click which pull the changes and update in crystal report.
May be helpfull in future.
i just can see the SQL query at "Database"->"Show SQL Query". How do I edit it in Crystal Report?
You are looking for Edit Command within the Database Expert ... see the screenshot below.
Go to Database Fields >> Database Expert
Select all the tables required for the report (Selected Tables section)
Go to the tab: Links
Drag and create all the links required to connect the tables links.
Then you can right click on the link and select Link Options
Here you can change your joins and your final SQL query will change accordingly.
For Crystal Reports 14.1.x, use Report (in menu at the top) ==> Selection Formulas ==> Record
Firstly I think you need to provide what version of CR you are using.
Secondly, to the best of my knowledge in Version CR13 using VS2010, you CANNOT hand edit SQL query like it we could in older version of CR.
Only way to change it is to update the links/joins on the tables in the Database Expert and Verify Database. These joins will then reflect when you click "Show SQL query".
Thirdly, there is a way you can control the query yourself, using "SQL Command". The steps to do this is mentioned in the other solution.
First Right Click on Database Fields > Set Datasource Location > Select View which you want to replace with another.
I've recently upgraded to VS 2019 with Crystal Reports for Visual Studio 13 SP25. The right click "Edit Command" option wasn't there for me either but I know it was in the past. However I finally did get it by using a toolbar that was added and a "Select Expert Record" option. The same option should be under the "Report" menu in the full version of Crystal Reports.
I used to create crystal reports by going into database expert, selecting tables and specifying the link manually. As I get a bit more comfortable with CR, there is a need for me to put the underlying SQL query into a store procedure to provide data to the report. But doing so will require me to rewrite the whole report which is time consuming.
So, my question is if there are any guru in the community that could and/or have tried to replace the underlying SQL (created by manually add table and links) with a store procedure or cmd without having to rewrite the whole report? I would love to get some hint of how to do that as I have a couple dozen of reports that need "adjustments" and time does not permit me to rewrite them all.
My Crystal Report versions are CR 2008 and CR 2012.
Thank you in advance.
In case you can use an existing software : this feature is available in a free Crystal reports viewer. Here is the documentation, which explains the use :
http://www.r-tag.com/Documents/RTag%20DataSource.pdf
... and here is where you can get your free license:
http://www.r-tag.com/Pages/FreeCrystalReportsViewer.aspx
Crystal does an absolutely horrible job of migrating from many tables to a single DB object, be it a Command or stored procedure.
You might be able to Database | Set datasource location... to map your SP to one of the many tables in the report (choose the one that has the most fields in use); I've never been able to get this feature to work trying to map a Command to a table.
'Best practice' for a really-poor 'feature' set:
create a formula field for each field that will be on the canvas, but isn't grouped (these fields won't be removed when you change datasources)
add the Command to the report; link tables if desired
manually switch grouping, record-selection formula, sorting, etc.
I have a Crystal Report I'm working on; last week it was returning results but when I fired it up this morning I was no longer getting anything. Checking the SQL query, I show that the table name is listed twice, for some reason:
SELECT "WMS_TESTINFO"."RECORD_NAME"
FROM "TestEnv"."dbo"."WMS_TESTINFO" "WMS_TESTINFO"
Any thoughts on what could have broken? I've checked that the database is connected and my data is still there.
The table name is listed twice as Crystal Reports creates an alias for every table.
This Crystal generated SQL:
FROM "TestEnv"."dbo"."WMS_TESTINFO" "WMS_TESTINFO"
Is in the format of:
FROM DATABASE.OWNER.TABLENAME ALIAS
This is normal for Crystal.
I would run that SQL in SSMS (remembering to remove all of the " first) to check that the data really is still there.
If it is, check that a filter hasn't been added to the report, via the Select Expert menu opton, to filter out all the data.
Lastly, go to Database > Set Datasource Location and re-apply the connection to ensure that the report is definitely pointing at the right location.