how to create a view using a command or results of a command in Crystal Reports - sql

I have SQL query which I can use as a 'command' to add data to my existing table in SAP Crystal Reports 2013. However I am looking to use the command to create a View which I will like to join to my original table rather. It makes the report run faster than the former.
Therefore please can someone guide me on how to create a view in SAP 2013 either by using a SQL command or the results of an existing report?

Related

Teradata SQL & cognos. How can I customize Cognos to accept a customized & more efficiently performing SQL

RIght at the outset I'd like to say that I am NOT a Cognos Guy .So I have totally disconnected myself from developing cognos cubes / reports whatever you want to call it.
There are COGNOS queries auto generated - very badly written that will cause the Teradata ( DBS 15.1.x ) system to Hog on spool & CPU . I can tune them beautifully after I pull them out from DBQL. I want to know HOW can I implement Custom Queries that can be run periodically as batch reports instead of Cognos auto-generating these queries.
E.g. You create a cube - its writes code behind it and then you can open the code and write custom code that is equivalent to the original code but performs a lot better. Then when you open the cube again - it remembers there is a custom SQL and runs that instead of its own auto generated SQL . This is just how I imagine one way it can do it but again- I am not a cognos resource so pl dont flag me down for lack of knowledge. That is exactly what I am trying to get an idea about
Thanks for bearing with me
In Framework Manager you can create one Query Subject with complex query inside. Do not import tables etc. Just create QS in put your query inside.
You need to use stored procedure to return your expected data and add it to Model.
Then instead of using couple of tables in Cognos report studio (and joins), add one query and point it to your stored procedure. This way your Cognos report will execute the procedure instead of generating query (which may not be efficient in many cases)

Joining table with Command - Crystal Reports

I need to make a report where I need to combine Command and another table together.
How can I integrate a table in the SQL query in Command so I can have all fields and formulas from that table in Command?
The query for Command is really long and complicated and it's used in another report. I'm trying to use this Command with another table called mCallEnd because I need couple of fields from mCallEnd table to make my report.
How can I do that in SQL query?
Command is on this link: http://www.docdroid.net/13pis/command1.txt.html
Report that I need to make looks like this: http://i.imgur.com/2boSrzJ.jpg?1
Try joining command and table in crystal report database expert. Which should work... if that is not possible for you.. try below.
Create a view with that command and join the view and table in crystal reports database expert.
Above solution provided assuming command and table are in same database.

Crystal Reports - how do I find which reports are being used?

I need to find out which of our Crystal Reports users are actually running, so we can get rid of those that are no longer being used. I can do some kind of query of the latest jobs run on the SQL server as described here:
How to get the last run job details in SQL
However I'm not sure how I could tie that back to the actual reports. I've tried opening a Crystal Report in Crystal Reports 2008 while running a trace on the SQL server using SQL Profiler, however I don't see any database calls in the tracethat would allow me to determine the name of the report being run.
How could I find out which Crystal Reports are actually in use?
I usually embed a unique identifier (the report's name or ID) in either a sql-expression field or the command's query.
If the DBA finds an issue with a given query (e.g. non-performant), this approach easily identifies the source.
SQL-expression:
//{%report_name}
(
'Daily Obstetrics Review [OB003]'
)
In the command:
SELECT 'Daily Obstetrics Review [OB003]' AS REPORT_NAME
...
FROM ...

Add exsiting query to report

My report calculates the stock of inks in my stores. I built a SQL statement in VB.NET and got the correct results. How can I display these results in my Crystal Report? Or design a report such that same results will be retrieved?
I tried to use SQL Expression builder but failed.
Usually you will link Data Tables to your report using Database Expert. Do the same in Database Expert, select the Database and you can see Add Command. Select that and click the > button. You will get a Window, write your SQL Query there and press OK.
After finishing this you can see Command in Database Fields which contains all your records got from the SQL Query as result.
In Database Manager choose Add Command and then type your SQL Statement there.

Crystal Report Duplicating in details?

so I have a template in Crystal reports using vb.net, I changed my data source location and that source still contains the needed tables for my report, the problem is this... My original template displays the exact report but when I changed its data source it duplicates the data in the details section(e.g I made a query that will show 1 item only,but instead I get 4).
Here is a screenshot of my problem:
(original at http://tinypic.com/r/5by6ih/5)
I want to alter the template rather than to make another one
This is normally down to an issue with the underlying SQL query. If you open the the report in Crystal (or visual studio) you should be able to "Show SQL Query". Run the query in Query Analyser or SQL Server Management Studio and look at the result.
If the underlying reason isn't then immediately apparent please paste the resulting output.