Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Pass parameters from main report to subreport Post Reply Post New Topic
Author Message
Radha
Newbie
Newbie


Joined: 11 Mar 2016
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote Radha Replybullet Topic: Pass parameters from main report to subreport
    Posted: 24 May 2016 at 6:45pm
This is my table structure
OrderId        PurchaseDate
175,          '2016-03-28 00:00:00'
176,          '2016-04-01 00:00:00'
177,          '2016-04-04 00:00:00'
178,         '2016-04-05 00:00:00'
179,         '2016-04-06 00:00:00'
180,          '2016-04-13 00:00:00'
181,          '2016-04-18 00:00:00'
182,          '2016-04-22 00:00:00'
183,          '2016-04-26 00:00:00'
184,          '2016-04-29 00:00:00'
185,          '2016-04-30 00:00:00'

Another table

id    ProductName    qty     price OrderId

183, 'merchandise a', 25, 10, 175
184, 'merchandise a', 70, 10, 176
185, 'merchandise a', 40, 10, 177
186, 'merchandise a', 30, 11, 178
187, 'merchandise a', 50, 11, 179
188, 'merchandise a', 100, 11, 180
189, 'merchandise a', 125, 11, 181
190, 'merchandise a', 10, 11, 182
191, 'merchandise a', 200, 11, 183
192, 'merchandise a', 150, 9, 184
193, 'merchandise a', 120, 9, 185


I have a simple report with from date, to date, productname parameters showing 3  fields viz
ProductName, Qty(Sum of quantity), LastPurchaseDate(Max of purchase date)

Later I created a new column "View Chart". It is a subreport which links to another report which has a chart on it. Bascically when a user clicks on this link he should see the  points on the graph showing when the price has changed on a given product.

My question is how do I pass the above parameter values from code behind to this link chart i.e. when view chart is clicked?


p.s. I am using crystal reports for visual studio 2013 in vs2010 c# windows application



Edited by Radha - 24 May 2016 at 6:46pm
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Jun 2016 at 4:18am
You don't have to do this in the code-behind. Try this:

1. Create an "On Demand" subreport in your main report to show your chart.

2. When you create the subreport, there is a "Links" tab you can use to set up the links from the main report. Or you can right-click on the subreport after you've created it and select "Change Subreport Links...".

3. Move the fields in the top left that you'll use to connect from your main report to the top right.

     a. If you're connecting to existing parameters in the subreport, turn off "Select data in subreport based on field" in the bottom right and select the subreport parameter to connect to in the bottom left.

    b. If you don't have existing parameters in the subreport, select the subreport field you want to link to in the bottom right.

-Dell
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.016 seconds.