Showing posts with label second. Show all posts
Showing posts with label second. Show all posts

Tuesday, March 20, 2012

Parameters: How to set null value

Hi, I have a problem.
I have two parameters: Group and Selection

In the first I have 2 choices: Total and Day
And the value of the second parameter is dynamic and is sets to allow null value
The behaviour I want is this: If a user select Total in the first parameter, the second must be set to NULL, if the selection is Day, the second must be set with a data set.

How I can set the value of the second parameter with null, I tryed

Have anyone an idea?

One way I have done this in the past is using '-1' as the Total value, and then letting the stored procedure pass in a null value by setting all '-1' parameters to null.

if @.param1 = '-1' set @.param1=null

System.DbNull.Value may work too.

Yet another option that may be possible is to use an expression to convert the parameter to a null value, and pass in the expression instead of the parameter to the report.

cheers,

Andrew

|||thanks,
I tryed System.DbNull.Value but give me this error : DbNull is a type in system and cannot be used as an expression

Perhaps I wrong something:
I wrote this in the datasets I use for the second parameter

=iif(Parameters!parm1.Value = 2,
"select a11.DATE_ID from Day" ,System.DBNull )

Another question, where I have to place this expression, in the store procedure?

if @.param1 = '-1' set @.param1=null

but I use a dataset.

Thanks in advance

|||

Not sure exactly how you are passing in a dataset as a parameter but looks interesting.

Instead of null perhaps you could use "SELECT null as DateID" instead? Or maybe an empty string?

The syntax for getting dbnull is to use System.DBNull.Value

=iif(Parameters!parm1.Value = 2,
"select a11.DATE_ID from Day" ,System.DBNull.Value )

cheers,

Andrew

|||If I use this expression "System.DBNull.Value" something don't work but I don't understand what.
but following your example and this link forums.microsoft.com/MSDN/ShowPost.aspx?PostID=766574&SiteID=1
it works

thanks

Monday, March 12, 2012

parameters show previous value on second execution of report

I'm running a crystal report from c#.net application, taking parameters from textboxes on the screen, using the parameters to do the data selection, and then printing the parameters in the heading of the report.

The first time I run the report, it displays properly, with the correct info in the heading. If I change the parameters and execute it again, the data on the report changes, but the heading still shows the original parameters that I entered.

Has anyone else encountered a problem like this? Or can you suggest a solution?

Thanks,
ChrisPost the code you are using for displaying the report.|||I solved this already by using a trick that fixes another crystal problem with the navigation end page button: I commented the code in the navigate method, and called my PopulateReport method from the page load event.

I don't know why this works, but it solved the problem.

Saturday, February 25, 2012

Parameters

Hello,
I have a report with 2 parameters ( 2 combo boxes ). I would like the
content of the second combox box dynamically to change depending on what I
select in the first combobox.
Is it possible to achieve this in SQL reporting services ?
Thank you
PascalYes, look at this posting
http://www.microsoft.com/sql/community/newsgroups/dgbrowser/en-us/default.mspx?&guid=&sloc=en-us&dg=microsoft.public.sqlserver.reportingsvcs&p=1&tid=51ea6a57-7bec-4787-93bc-5899a3ea9d71&mid=491a878a-2a2e-4cda-a96a-2cdc00423519
HTH
Charles Kangi, MCT, MCDBA
"Pascal Simler" wrote:
> Hello,
> I have a report with 2 parameters ( 2 combo boxes ). I would like the
> content of the second combox box dynamically to change depending on what I
> select in the first combobox.
> Is it possible to achieve this in SQL reporting services ?
> Thank you
> Pascal
>
>