Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Create Cross tab report that displays 2D Array dat Post Reply Post New Topic
Author Message
RealQMan
Newbie
Newbie
Avatar

Joined: 22 Aug 2007
Online Status: Offline
Posts: 25
Quote RealQMan Replybullet Topic: Create Cross tab report that displays 2D Array dat
    Posted: 22 Aug 2007 at 12:00pm
LOL

Hi, I am working to produce a cross-tab report that would display customized data from a two dimesional array structure.

The idea is that report is essentially a graphical representation of the 2-dimesional array created during run-time. It's easy to create an array structure with 8 Rows x 12 Columns, but I am not sure how to create a cross tab report with a table that has 8 Rows x 12 Columns.


           JAN   FEB   ....   DEC

Total 1   1      1             2000
Total 2  120   7             600
'' ''
Total 8   3      5              213



I believe once I figure out how to place a table on report, then I will be better equip to assign the array data onto the table....

Anyone that has previously thought up a solution to my problem please feel free to guide me through this... I tried google the topic but  haven't found anything good.


Hug


Edited by RealQMan - 22 Aug 2007 at 12:08pm
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 22 Aug 2007 at 1:52pm
Questions: Are you trying to create a cross-tab object based on array data? Secondly, where is the two dimensional array coming from? Did you build it in .NET and you want to pass it to CR as a datasoure, or are you creating the array in CR?
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
RealQMan
Newbie
Newbie
Avatar

Joined: 22 Aug 2007
Online Status: Offline
Posts: 25
Quote RealQMan Replybullet Posted: 22 Aug 2007 at 2:05pm
Yes, exactly. I will have an array which report base on.

Before report is generated, my c# application will run some calculation and store the results into the array. It would be better if I can somehow create a dataset that I can bind during design-time, and all i really need to do is dump the data at run-time and allow the report to display the cross-tab for me. But how do i create a database table that models array data????? I would create the array at run-time unless someone can explain the reason not to.

I am more familiar with .net syntax than CR syntax.. so my answer would be to pass it to CR as a datasource. What would be the clean way of doing it..???

IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 22 Aug 2007 at 2:18pm
yes, your idea will work fine. You just need to copy the array into a dataset. Google how to create a dataset dynamically. I wrote  some code in my CR.NET book. It goes something like:

DataTable dt = new DataTable("Customer");
DataColumn dc = new DataColumn();
dc.ColumnName = "Col1";
etc.

It's kind of lengthy to do, but not a big deal if you don't have too many columns. Anyway, there should be plenty of code on the web or on MSDN that give you a complete example.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
RealQMan
Newbie
Newbie
Avatar

Joined: 22 Aug 2007
Online Status: Offline
Posts: 25
Quote RealQMan Replybullet Posted: 22 Aug 2007 at 2:26pm
I will spend more time trying out your suggestion. It's unfortunate there's not a large number of articles, and tutorials that I can use to save the trouble of asking someone who knows. I'll let u know if I am stuck on anything else.

wish me luck
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 22 Aug 2007 at 2:56pm
Well, once I have the .NET 2005 book come out in early 2008, then I'll have everything you could want to know in it and many pages of code samples. But I haven't started revising it yet and there is a lot of work to do before that happens. I just finished the CR XI book and have to take a break before starting another one. 

Good luck.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
RealQMan
Newbie
Newbie
Avatar

Joined: 22 Aug 2007
Online Status: Offline
Posts: 25
Quote RealQMan Replybullet Posted: 23 Aug 2007 at 8:19am
I was able to get the report up running due to your suggestion. It's nearly perfect except that the report is broken up vertically into two sections. Sleepy
                     
                      Section 1                                    Section 2
             Jan   Feb  Mar  Apr  ...  Aug  |     Sep    Oct    .. Dec    Total
Row A     1    2      3      4          8      |        9        10        12       78  
Total        1     2     3     4          8       |        9        10        12      78


My guess is that the columns are broken up b/c of limited spaces on a printed page. So, the first section is printed on page 1 and second section is printed on page 2.

Where inside the code would I can force all columns to completely print on one page?
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Aug 2007 at 11:33am
I'm glad you got it working! BUt I'm confused about section 1 and 2. You just mean page 1 and 2? Anyway, you can't force them to be on the same page. You either have to go to landscape so that there is more room to work or you have to make the columns smaller. It's a physical limitation of that report, not a code issue.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.