How do I add a column in Crystal Reports 2008?

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.
mattkovoAsked:
Who is Participating?
 
peter57rCommented:
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
 
MIKESoftware Solutions ConsultantCommented:
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
 
mattkovoAuthor Commented:
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
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
peter57rCommented:
How do you specify which columns to show and hide?
0
 
mattkovoAuthor Commented:
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
 
peter57rCommented:
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
 
mattkovoAuthor Commented:
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
 
MIKESoftware Solutions ConsultantCommented:
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
 
MIKESoftware Solutions ConsultantCommented:
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
 
mattkovoAuthor Commented:
I think I'll try one of those out!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.