Notices



Reply
 
LinkBack Thread Tools Display Modes

Old 08-27-2008, 10:39 AM   #1 (permalink)
ggs ggs is offline
Gerhard

Join Date: Feb 2008
Location: South Carolina
Posts: 32
Rep Power: 0 ggs is on a distinguished road

Blackbaud Products
- Raiser's Edge (RE)

Stored Procedure output variable and recordset

If I am basing a crystal report on a stored procedure, is there any way to pass an output paramater calculated from a stored procedure into a crystal report, along with a recordset?


Ideal World Example: (Used to just show the theory, there is no relevance for this query)

Alter Procedure SampleDatasetWithParamater (@OutputToCrystal int OUTPUT)

Set @OutputToCrystal = (SELECT COUNT(DISTINCT FIRST_NAME) AS Firstnames
FROM CONSTITUENT);

Select * From RECORDS ;


What would I have to do to be able to have Crystal receive a recordset and also one (or a few) calculated values to use elsewhere in the report?

Say the report header would contain:

"There are {@OutputToCrystal} distinct first names in the system"

Then the rest of the report would be related to the RECORDS recordset that the SP brought in.

Is this possible or is there a creative way to do this? Thanks in advance.

Gerhard
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Old 08-27-2008, 11:27 AM   #2 (permalink)
Crystal Reports Guru

DrewAllen's Avatar

Join Date: May 2006
Location: Philadelphia, PA
Posts: 1,155
Rep Power: 4 DrewAllen is on a distinguished road

Blackbaud Products
- Raiser's Edge (RE)
- Information Edge (TIE)
- API/VBA

From what I understand, Crystal will only use the last recordset returned by the stored procedure. Can you return the output parameter as a static column in the recordset?

Drew
__________________
J. Drew Allen
Children's Hospital of Philadelphia

Crystal Reports and SQL Server Consultant

It is better to live your destiny imperfectly than to live an imitation of somebody else's life with perfection.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Old 08-27-2008, 12:12 PM   #3 (permalink)
ggs ggs is offline
Gerhard

Join Date: Feb 2008
Location: South Carolina
Posts: 32
Rep Power: 0 ggs is on a distinguished road

Blackbaud Products
- Raiser's Edge (RE)

Yes, it looks like returning it as a static column will work, great idea. I also was able to use a second SP to get the variables and use both procedures in the report by assuring the two result sets were not linked in the Link manager.

Do you see either method being better than the other?

Option 1, static columns created in stored procedure with dataset and basing report on this single procedure.
Option 2, using 2 separate SPs with no links in CR, one with dataset, the other with variables as a single row dataset.

Both methods appear to work, but i havent really tested option 2 thuroughly yet.

The Data for the report in Option 2 would be based on:

Procedure 1: Select * From Records
--and--
Procedure 2: Select Col1 = "Title1", Col2 = "AnotherTitle"

Having no links between the two, I do get a warning message in Crystal about multiple starting points but i am not trying to group on data from each, only the one result set from the first procedure. The SP 2 will only be returning one row with my variable values as the data.

Thoughts? Any forseeable problems?

Thanks for the help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
output paramater, recordset, stored procedure


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Cheap Gas - Loans - Mortgage - Arizona Pools
All times are GMT -6. The time now is 03:28 AM.

Miscellaneous


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by BBpixel Team 2008 :: jvbPlugin R1012.364.1

SEO by vBSEO 3.2.0 Copyright 2008 Blackbaud User SocietyAd Management by RedTyger
Inactive Reminders By Icora Web Design

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64