Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing parameters to Crystal report

Status
Not open for further replies.

123ASP

MIS
Nov 2, 2002
239
US
hi, I need your help.
I have a crystal report that has 3 parameters (partnership_name,investor_name,project_name)
I have 10 partnership. in each partnership I have 5 investors, invested in 3 project.
When I generate the report, I have to manually select partnership_name,investor_name,project_name to generate an investor report. It is time consuming to do so, Is there a way to make a code generate those report and automatically pass the parameters to the report template.
thanks for your help
Al
 
You can hardcode the Investors and Projects in the record selection formula (or any part thereof), as in the following:

If {?Partner} = "Microsoft" then
(
{MyTable.MyInvestor} in ["Gates", "Forbes", "Dubuya", "Trump", "Winfrey"]

and

{MyTable.MyProjects} in ["Solar Subs", "Lard farm", "Battered personal tissue"]
)

else

If {?Partner} = "Oracle" then
etc...

Hopefully this moves you in the right direction.

-k kai@informeddatadecisions.com
 
To go a bit deeper into the original problem, that can't logically be fixed through an if else statement with arrays, since the data volume is quite large...I have an additional question:

My case is that I have a report that I need to pass an ID to a sub-report. I then use this ID to call data that can have multiple results (one to many). My report works great, when I am running it on one "record" (ID) at a time. CR prompts me to enter in a parameter value (the ID) and then the sub-report page does it's work and grabs the correct data to display. My problem is when I need to run this report on a large set of "records"...the system prompts me for the parameter (the ID) and then it does it's thing and lists the same data for my sub-report, for ALL the records..not just the one that meets the parameter Id = subreport Id requirement. Is there any way to make CR use the ID that is passed per record as the parameter, instead of asking the user to input it? For example:

Record ID 100 has two children IDs: 100.1 and 100.2 AND
Record ID 101 has three children IDs: 101.1, 101.2 and 101.3

I am passing the record ID into my children sub-report, in hopes of getting the following data:

Record Children
100 100.1
100.2
101 101.1
101.2
101.3

INSTEAD, I get this:

Record Children
100 100.1
100.2
101 100.1
100.2

So, when CR prompts me for a value, and I enter in 100 for the ID, it puts Record 100's children as the children for ALL records listed. If I do not put any ID in the parameter prompt, then everything comes up empty. Any idea how to get the report to grab the record ID then go through the report, then repeat the same thing for all other records? I hope this makes sense. Also, I cannot do an array, since the data set I am working with has 18000+ records.

Dgolay
 
Please post your table structures, example data, and expected output.

If you have a record ID in both tables, and I assume you do to provide the relationship, just link on those.

If no, I would simplify this by creating a SQL Expression on the subreport data to eliminate the decimal portion on the child ID, and link to that.

In SQL Server, you might use:

floor({table.field})

-k
 
Actually the child ID do not have decimals, but I used that in the example, just to get my point across ( I assumed I was being too confusing anyway). This is how I have it set up:

In the main report, I have a table called Record and the field I link is ID. In the sub-report, I have a view (table) called Child and the Id is Record.ID. So, my parameter on the sub-report is to the Record.ID from my main report. My select expert statement says to grab all records where Child.ID = ?Pm-Record.ID

This works right for running the report on one record, but fails for two or more. Only, because I cannot get CR to stop prompting me for a parameter. I want it to grab the ID that is already has from the Record table, then pass that to the sub-report, the same way it does when I enter the parameter value. Is this possible? I am using CR 8.0. Thanks for your last post and for any future help...this has been haunting me for a week now:(
 
I just saw your first line of your last post, sorry, I overlooked it the first time around. Here is the data you requested:

Main report:

Record Table with ID, Name, Date_Created, etc.

Sub-report:

Child Table with Record.ID, Name, Text

Example data is:

I have a record ID of 18000 and in my child table, I have an entry for this record that gives me a Record.ID of 18000, a name of Child Record and text that the user entered that shows ;12345, See Record 17800'

Expected output:

Record Children
18000 12345
See Record 17800

I hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top