Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to modify table to add more rows? Post Reply Post New Topic
Author Message
emceemic
Newbie
Newbie


Joined: 05 May 2010
Location: Canada
Online Status: Offline
Posts: 2
Quote emceemic Replybullet Topic: How to modify table to add more rows?
     Posted: 05 May 2010 at 3:57am
Quick question about reporting guys..
 
For example, say the table I currently have show the following data:
 
Impact to Business   Business Owner Name             Breakdown
Application                John Doe                             Application
Hardware                 Joe Smith                            Hardware
Multiple                    John Doe                             1:Hardware, 2: Application
 
This is how the data is stored in the datatable itself.
Is there a way I can separate the 'Multiple' one to show individual info in different rows? ideally, the table I need is:
 
Impact to Business   Business Owner Name             Breakdown
Application                John Doe                             Application
Hardware                 Joe Smith                            Hardware
Multiple                    John Doe                             1:Hardware, 2: Application
Hardware                 John Doe                             Hardware
Application                John Doe                             Application
 
Or.. is it possible that I create a virtual/dummy table of my own and loop through the first table to create the desired table?
I am on the business reporting side and hence do not have authorization to work this out from the db side..nor do we have support for .net or any other programming packages to connect to db to create tables so I basically am stuck with crystal to do the job...I am quite new to crystal and am unsure.. but does the 'Add Command' from database expert do any good in such a case?
Any help will be very much appreciated.. Thanks
 
Michael Chang
 


Edited by emceemic - 05 May 2010 at 4:45am
Process Analyst
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 05 May 2010 at 12:21pm
I can't think of any way to do this in Crystal directly without possibly using a command.  For the command, you have to know how to write SQL against your database, so it may be more technical than you already have the skills for.
 
When the Impact is "Multiple", what is the greatest number of items that can appear in the Breakdown?  Do you know what type database this is using (e.g. SQL Server, Oracle, etc.)?
 
-Dell
IP IP Logged
emceemic
Newbie
Newbie


Joined: 05 May 2010
Location: Canada
Online Status: Offline
Posts: 2
Quote emceemic Replybullet Posted: 06 May 2010 at 3:56am
Hello,
 
We are using MS SQL server. I am relatively well with sql queries, with the only problem that my department does not have sql express mgmt studio, nor access to modify the database. Basically, we use Remedy Action Request system, which is in a nutshell a more user friendly application that sits on top of ms sql. We connect crystal to remedy to pull data for analysis. My question is, is it possible to do sql commands and such in crystal reports as opposed to creating a table in the database in the format required? I am new to crystal, and with my first take it seems crystal can only do SELECTs and cannot do CREATE commands?
 
 
 
For "multiple" imacts, the greatest number of items for breakdown is less than ten.
 
Thanks,
 
Michael 


Edited by emceemic - 06 May 2010 at 4:06am
Process Analyst
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 06 May 2010 at 4:20am
If it's a SQL Server back end, yes you can create your own commands.  I would use the ADO type connection to SQL Server rather than an ODBC connection because it's faster and you have access to more of the SQL Server-specific syntax.
 
In the Database Explorer, open your connection to the database.  Under the connection name and above the database name you should see "Add Command" where you can type in SQL.  There is no syntax highlighting and the SQL doesn't get checked until you try to save it.  However, Quest Software offers a free 30-day trial version of Toad for SQL Server here: http://www.quest.com/toad-for-sql-server/  You could use this to develop your SQL and then paste it into Crystal.
 
-Dell
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 07 May 2010 at 3:29am
hilfy, are you saying that I can create temp tables in the Command object and access them to report on?
 
As a developer, I would really hate for someone to start creating/modifying data in the db for a report...especially someone who doesn't have authorization. On-the-other-hand, if he is creating a temp table in code that is going to disappear or some other structure in the report, I don't care as it should only impact his report, though it may suck up/lock resources on the db and thus drag down system performance...but that is less of a concern than alteration of data / db schema.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 07 May 2010 at 3:42am

You can only create temp tables if you have the access rights to do so.  And you're better of using a stored procedure to return your result set than to create a temp table.

However, I wasn't talking about temp tables.  I can see how to write a SQL command, using some unions, that would parse out the multiple values in the "Multiple" record so that you have individual records.  The max number of possible items that can be in a multiple record must be known in advance and you have to write a separate Select statement for each in the union.

 
-Dell
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 07 May 2010 at 4:13am
I was wondering if you were thinking something like Unions and multiple selects or a temp table.  I, of course, wouldn't / don't have a problem with selects and unions... 
 
Actually, all of my reports gather / process their data from stored procs and the parameters are gathered from wizards in our application, so I don't have much need of the Command object, but was just wondering about how much else I don't know about Crystal.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum