Is there an equivalent to WhilePrintingRecords in SQL Server Reporting Services

Posted on 2008-01-24
Medium Priority
Last Modified: 2012-06-27
Does anyone know if there is a similar function to WhilePrintingRecords; in SQL Server Reporting services?  If not, how can I force each record to be processes and outputted in SQL Server Reporting Services?
stringvar sBPSysObsName;
if (instr(sBPSysObsName,"Sitting") > 0) then 'Sitting'
else if (instr(sBPSysObsName,"Standing") > 0) then 'Standing'
else if (instr(sBPSysObsName, "Supine")  > 0) then 'Lying'
else ''

Open in new window

Question by:boydosborne
LVL 10

Expert Comment

ID: 20741247
are you using .net app ?

Author Comment

ID: 20741953
I am using Visual Studio.net  2000 for building my reports.  I was hoping to use the code section of the report to build something that could process each record, similar to the whileprintinrecords in crystal.  But I am not sure exactly how I could get the function to fire on each record and then within the report populate the necessary objects.  Thanks for your response. Any additional help is greatly appreciated.  Links, tutorials.
LVL 101

Expert Comment

ID: 20743407
The WhilePrintingRecords command in Crystal controls when in the report building process the formula is executed.  It  has nothing to do with forcing Crystal to process a record.

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


Author Comment

ID: 20849609
Can you define a variable public outside of a function and set the variable within the functions.  Is there any ramification for doing this?  Then I could use the variables in multiple functions throughout the report.  I believe this is the behavior that I need to mimic in the report.  Thanks for all of your help.
LVL 18

Accepted Solution

chrismc earned 500 total points
ID: 21017545
You are falling into the classic problem when switching to RS from Crystal. Naturally, you are thinking how you'd do it in Crystal and looking for the equivalent in RS. I did this too initially.

RS works completely differently and you will only lose hair with this approach!

RS doesn't have multiple passes that can be tapped into. Data manipulation in this way should be kept in the query that supplies the data.

Having said that, you're example can be done easily within the cell;

=Switch(InStr(Fields!myField.Value, "Sitting")>0, "Sitting", InStr(Fields!myField.Value, "Standing")>0, "Standing", InStr(Fields!myField.Value, "Supine")>0, "Lying")


LVL 18

Expert Comment

ID: 21017603
In reply to your "Variable" question.
You can define variables in the VB code behind, but they get wiped out with each SOAP call, which loosely means every time there is a page break.

You can have hidden, internal parameters but these have to be populated at the stage data is retrieved and cannot be manipulated within the layout itself.

With RS it's always better to keep the complexity in the queries themselves - that piece of information took me quite a bit of time and pain to learn!


Expert Comment

ID: 21043722
Force accepted.
Community Support Moderator

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through setting up a JasperReports Server using the AWS EC2 instance, and this article will cover some basic administration tasks I had to perform.
How to increase the row limit in Jasper Server.
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Suggested Courses

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question