Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Passing paremeters to subreport Post Reply Post New Topic
Author Message
OlgaS
Newbie
Newbie


Joined: 02 Dec 2011
Location: United States
Online Status: Offline
Posts: 7
Quote OlgaS Replybullet Topic: Passing paremeters to subreport
     Posted: 07 Dec 2011 at 7:22am

SQL proc populates table1 and table2 that have the following insurance policy  information:

table1

policy

insured name

policy eff date

policy exp date

AAA111111100

Tom G

01/01/2008

06/30/2008

AAA111111101

John D

07/01/2008

12/31/2008

AAA111111102

Kim T

01/01/2009

06/30/2009

AAA111111103

Jesse M

07/01/2009

12/31/2009

BBB222222200

Olga S

01/01/2010

06/30/2010

BBB222222201

Alex F

07/01/2010

12/31/2010

table 2

policy

premium

losses

AAA111111100

$120.00

$300.00

AAA111111101

$140.00

$0.00

AAA111111102

$150.00

$0.00

AAA111111103

$135.00

$200.00

BBB222222200

$120.00

$0.00

BBB222222201

$133.00

$0.00

 

We have the 'main' CR that displays info from table1 and Subreport that displays info from table2. 

Input parameter is policy number .

When we open CR, there will be a prompt 'Enter policy number'. For example, I enter 'AAA111111103'.

The main report will display the data for this policy:

 

policy

insured name

policy eff date

policy exp date

AAA111111103

Jesse M

07/01/2009

12/31/2009

 

and the subreport should display the data from table 2 for all policies that have 2 right digits less than the input policy.

 

In this case, it will be policies

policy

premium

losses

AAA111111100

$120.00

$300.00

AAA111111101

$140.00

$0.00

AAA111111102

$150.00

$0.00

 

 In other words, the subreport should display financial data for 3 previous policies. 

 

I can pass the input parameter ('AAA111111103') to the subreport, but in this case it will show financial information just for

policy

premium

losses

AAA111111103

$135.00

$200.00

 

Any ideas how to display just 3 previous policies?

 

Olga

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Dec 2011 at 7:30am
maybe this?...
pass the policy field as you linked value (example as ?pm-parameter)
change the select statement to use
left(table.field,10)=left(?pm-parameter,10)
and
val(right(table.field,2)) < val(right(?pm-parameter,2))


Edited by DBlank - 07 Dec 2011 at 7:52am
IP IP Logged
OlgaS
Newbie
Newbie


Joined: 02 Dec 2011
Location: United States
Online Status: Offline
Posts: 7
Quote OlgaS Replybullet Posted: 07 Dec 2011 at 7:38am
I will try this. Thanks
IP IP Logged
OlgaS
Newbie
Newbie


Joined: 02 Dec 2011
Location: United States
Online Status: Offline
Posts: 7
Quote OlgaS Replybullet Posted: 07 Dec 2011 at 8:14am
It worked! Thanks againSmile
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