Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Query For Subreport Post Reply Post New Topic
Page  of 2 Next >>
Author Message
Ganesh Khuspe
Newbie
Newbie


Joined: 06 Feb 2013
Online Status: Offline
Posts: 18
Quote Ganesh Khuspe Replybullet Topic: Query For Subreport
    Posted: 13 Feb 2013 at 12:14am
Hey Hi Guys,

Can Anybody tell me how can i use query to retrieve data from SQL server DB to my SubReport of Main Report as i dint got any solution after search on it...As i m new to Crystal report so please help me to get sort this prob...

Thanks in advance...
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 13 Feb 2013 at 6:53am
HI
 
Open crystal reports--create a DSN to connect to your SQL server and choose tables and fileds which required to fill your report.
 
Sub report is nothing but a report which is incorporated in another report.
 
Here you create two separate reports and combine as one.
Thanks,
Sastry
IP IP Logged
Ganesh Khuspe
Newbie
Newbie


Joined: 06 Feb 2013
Online Status: Offline
Posts: 18
Quote Ganesh Khuspe Replybullet Posted: 13 Feb 2013 at 8:59pm
Thanks for Reply sastry,
Actually i have made report in which i have fetched data from 5 tables..Now i want to make sub report and for dat i have to fetch data from 4 tables by joining those tables in sql..so how to do dat?

Edited by Ganesh Khuspe - 13 Feb 2013 at 9:00pm
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 13 Feb 2013 at 11:40pm
Hi

Go in Insert Menu-- Select Sub report -- It will ask for two options.. one is insert a existing one or create a new one.

Select new one and create sub report using 4 tables, finally it will ask you where to insert your sub report, choose the appropriate section.

Thanks,
Sastry
IP IP Logged
Ganesh Khuspe
Newbie
Newbie


Joined: 06 Feb 2013
Online Status: Offline
Posts: 18
Quote Ganesh Khuspe Replybullet Posted: 14 Feb 2013 at 12:51am
I have Added Subreport in Main Report as u said..but not

able to understand how to add tables into it as i have

used dataset while making subreport connection because i

want to fetch data through query..And i want retrieve some

fields from all those 4 tables by joining those

tables...what can i do?

Edited by Ganesh Khuspe - 14 Feb 2013 at 12:54am
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 14 Feb 2013 at 1:16am
Hay Ganesh..

1st Point :  You want to add 4 tables query or 4 tables ?  Query is some thing which you are writing SQL on your own.

2.Even though your main report consist of all 4 tables, you need to reselect those tables while creating sub report.

3.For time being forget you are preparing a sub report.  Do the following :
--Create a new report by creating a datasource (DSN/OLE DB /Native etc.)
--Now select the tables and join them (or) if you want to write your own SQL then click on Add Command under datasource connection and past your SQL.
--Now choose your fields and save the report.

4.  Now open your actual Main report and go in Insert Menu--Sub Report-- and select the above report and place it.



Thanks,
Sastry
IP IP Logged
Ganesh Khuspe
Newbie
Newbie


Joined: 06 Feb 2013
Online Status: Offline
Posts: 18
Quote Ganesh Khuspe Replybullet Posted: 14 Feb 2013 at 1:38am
I got it what u r saying...I have made the report...n it is working properly..but when i m adding it in the main report then it is not showing me the data ...i want data on he basis of main report field..wat to do?
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 14 Feb 2013 at 1:58am
Hi

You need to link your sub report to main report. 

You can link through Parameters, Fields or Formulas.

Right click on sub report and go in change sub report links and link
Thanks,
Sastry
IP IP Logged
Ganesh Khuspe
Newbie
Newbie


Joined: 06 Feb 2013
Online Status: Offline
Posts: 18
Quote Ganesh Khuspe Replybullet Posted: 14 Feb 2013 at 2:12am
For my main report i m having intime and outime as parameters in query, and my subreport i used the same parameters..when i m linking the subreport to main report there are no intime and outime found as it is not in main report..now m confused how to bind both the report..can u plz help me?
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 14 Feb 2013 at 2:34am
HI

Check the data types of these parameters.. if your main report parameter is string and sub report parameter is number then it will not show.


Thanks,
Sastry
IP IP Logged
Page  of 2 Next >>
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.