Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: crystalreport different tables Post Reply Post New Topic
Author Message
attawba
Newbie
Newbie


Joined: 14 Apr 2009
Location: Morocco
Online Status: Offline
Posts: 1
Quote attawba Replybullet Topic: crystalreport different tables
     Posted: 14 Apr 2009 at 3:09pm
hi

 Currently Im working on a web application using asp.net with C#.

I need to create a report depends on user's selection of the database fields, i.e. the user may need information that are in different tables on the report. The question is how can I create a dynamic crystal report for this situation?

in  my project, i have many tables 

exemple : i have table  customer  (id_customer,customer_firstname,customer_lastname, customer_email), and table society(id_society, id_customer, societyname,societyadress,phonenumber)

so from those table , i want to generate report with crystal report which has those columns: ( societyname, fistnamecustomer,lastnamecustomer, societyadresse) and the user will choose the society in a dropdownlist!

so if someone can help me and show me how to proceed with those tables,

 im using sql server (linq to sql)


IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 15 Apr 2009 at 6:54am
Crystal doesn't do dynamic reporting.
 
With that said, you can get the appearance of dynamic reporting, but it is going to be limited as Crystal doesn't do dynamic reporting. (just can't say it enough, crystal reads data from a known format and displays it in a template.  both the data structure and template need to be 'known' at design time...so not dynamic)
 
How do you get around this.  Since stored procs are out of the question (they too are not dynamic), I would use the middle layer to create an XML dataset with set columns for the data.  You can then pass any type of info from as many tables as desired as long as the information is stored in the predefined data column.  Since Datasets can have multiple tables, you can have a second table with what the columns are called, and have Crystal read the column names and display them.  It appears dynamic, but isn't.  where it gets tricky is if some of the columns are numeric and you want aggregate functions performed on them.  Again the second table can store this information and you can create formulas to respond this in Crystal.
 
You can set the dataset to the crystal reports dataset or data binding...I don't remember at the moment as mine is in an inherited class and all I need to do is call a property, which sets the dataset and displays the report.
 
Just remember, you need to pass the same data structure to the report all the time.  You can have extra fields, but you can never skimp on the fields that are actually used in the report (a check mark is displayed for used fields) because if Crystal doesn't see the fields, it will throw an error.
 
Hope this guides you to the final report, as you can see, your request is way too complex to be answered here.
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