[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I add a column in Crystal Reports 2008?

Posted on 2009-02-10
10
Medium Priority
?
190 Views
Last Modified: 2012-05-06
I've searched but obviously not good enough.  How can I add a column to a report? I currently just have 1 big column and want to add 4 more that are displayed conditionally.
0
Comment
Question by:mattkovo
  • 4
  • 3
  • 3
10 Comments
 
LVL 17

Expert Comment

by:MIKE
ID: 23608343
Well, there are quite a few ways to "ADD A COLUMN" to a report.. basically...you'll need to choose it from the dataset. You can DRAG and DROP each separate column on the report. Then you can right click each field and format them conditionally.

Of course you can CREATE a formula field and then choose it in the same way that you did the other dataset fields.

I hope this helps. I you need more info, please provide some more detailed, specific info on exactly what you are trying to achieve.

Thanks
M
0
 

Author Comment

by:mattkovo
ID: 23608441
I'll try to explain better..

I'm looking to display a column conditionally.  That is easy....what I want to do is shift the other columns to the left if a particular column is not being displayed. I don't want to use a cross-tab report.

Example...

Col1    Col2    Col3       Col 4
Let's say I don't wan't to display Col2....so no I want the report to look like this...
Col1    Col3    Col4
NOT like thils
Col1               Col3       Col4
0
 
LVL 77

Expert Comment

by:peter57r
ID: 23608963
How do you specify which columns to show and hide?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:mattkovo
ID: 23612089
I can use a parameter for that or for my case...just do an if then true statement.

I still don't know how to add a column.  Any ideas?
0
 
LVL 77

Expert Comment

by:peter57r
ID: 23612444
This is going to be a lot of work.
One way or another you are going to have to build each row individually using one or more formula fields.

For example you can build the row as a single string...

stringvar myrow;
If {?myParam} <>1 then myrow:= {table.field1} & "       ";
If {?myParam} <>2 then myrow:= Myrow & {table.field2} & "       ";
If {?myParam} <>3 then myrow:= Myrow & {table.field3} & "       ";
//remove final spaces
myrow := left(myrow, len(myrow)-7  ;
myrow

You would have to use a fixed width font and the number of spaces after each field would probably need to be adjusted based on the length of the field.
0
 

Author Comment

by:mattkovo
ID: 23612620
The fields will all be the same width.  I was looking around..what exactly is a template field?

Is it possible to setup all 4 columns and then say (starting with the left column) if {expression} then display, else display next column in its place if {expression2} is true? And so on?
0
 
LVL 17

Expert Comment

by:MIKE
ID: 23612895
I would suggest doing this WITH IN THE SQL LOGIC...not in Crystal. You can basically get this all done using SQL Script.

M
0
 
LVL 17

Expert Comment

by:MIKE
ID: 23612904
Then just use your Stored Proc or SQL Script in Crystal at the ADD COMMAND datasource line to "display" it in Crystal...then format as needed.....
0
 
LVL 77

Accepted Solution

by:
peter57r earned 2000 total points
ID: 23612952
A template field is not relevant here.  It is to do with standardising formatting.

There are various ways to build the row, but if you try to post data values to 'the next required' column, and you allow for more than one column to be suppressed then the complexity of the if statements will increase considerably.
You could use formula fields each of which contains logic to work out which value should be output from that particular formula field and then just place the formula fields in the detail line.
Or you could place copies of data fields on top of one another in each column and suppress the unwanted ones.
The approach I illustrated above is potentially the simplest in terms of the logic but limits what you can do with the result.

0
 

Author Closing Comment

by:mattkovo
ID: 31545421
I think I'll try one of those out!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

834 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