cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Report expert please help

Former Member
0 Kudos

Hello,

I have a requirement of generating dynamic columns on the crystal report.
like A customer had 10 columns then dat 10 columns shud be visible, B customer has 24 columns den dat many shud be visible on the report.
There might be possibility of columns getting increased or decreased for A or B customer, in short the columns are treated as rows in the database
so there is huge possibility of column getting increased.
I 'm confused how to achieve it, there are certain things available on the net but there is no specific code.

Plz help !

Message was edited by: Ludek Uher

Accepted Solutions (1)

Accepted Solutions (1)

JWiseman
Active Contributor
0 Kudos

hi Harshad, as the columns you need are stored as rows in the database (from your initial post) your data may look something like this (i'm using csv though)

UserName,StationName,Value

"ABC","Station 1",1

"ABC","Station 2",1

"ABC","Station 3",3

"DEF","Station 1",2

"DEF","Station 2",2

"DEF","Station 3",1

"DEF","Station 4",1

"GHI","Station 2",3

"GHI","Station 5",2

and the cross tab would then look something like this

the column field in the Cross tab expert would be the stationname field, the row field would be the username field, and the summary field would be the value field.

the report based on the above csv is also attached. please unzip and change the file extension from .txt to .rpt.

jamie

Former Member
0 Kudos

Hello Jamie,

I did the same, used the crosstab report, suppressed the Total since I don't require that field.

Can you just help me with one thing instead of having levels in the format 1.00, I want to have just 1, no decimals.

Answers (3)

Answers (3)

JWiseman
Active Contributor
0 Kudos

hello Harshad,

you mentioned that the number of columns is based on the number of rows in the database for a certain field. the easiest way to create a report where the number of columns based on the number of values for a database field is to Insert a Cross-tab and use that field as the Column field in the cross-tab.

the other option if you don't like the formatting limitations is to create a multi-column report. to do this,

  1. create a Group on the field that will represent the column
  2. right click on the Details section and go to the Format Section Expert
  3. format the section to use Multiple Columns...the Layout tab appears
  4. in the Layout dialogue, check Format Groups with Multiple Column and choose a width for the column
  5. exit the section expert for the Details section
  6. right click on your Group Footer and choose Section Expert
  7. check Print at Bottom of Page...this will force each group value to have a new column

i'm attaching two examples of multi column reports...a very simple one, and one with lots of formatting etc.  after you unzip the files, change the extension to .rpt to open in crystal.

cheers,

jamie

Former Member
0 Kudos

Hello Jamie,

The attachment is not clear to me, could you please tell something about cross tab n how could I achieve dat .. my requirement.

Username | Station 1  | Station2 | Station3

ABC         |  1            |   2          |    3

The station are my dynamic columns which I don't know at design, I just want to run my query and bind it to the report

0 Kudos

You may want to post to this forum: http://scn.sap.com/community/crystal-reports also. And search first, others have posted the same question.

Simplest way is to create a template report with all of the fields you will allow in them. The fields are simply text boxes, at runtime simply replace the text boxes with fields and delete the ones not required.

I believe what you are wanting to do is create a report designer, look at the RAS RCAPI samples on this page:

http://wiki.sdn.sap.com/wiki/display/BOBJ/NET+RAS+SDK+Samples#NETRASSDKSamples-Exporting%2FPrinting

Don

former_member183750
Active Contributor
0 Kudos

Hello Harshad

Are you trying to do this at runtime, or in the CR Designer?

What version of CR?

If you are looking to do this at runtime, what version of .NET?

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Share Your Knowledge in SCN Topic Spaces

Former Member
0 Kudos

Hello Ludek,

I 'm using crystal report 2010, I 'm looking do this at runtime since I don't know the column names

at design time