Showing posts with label expression. Show all posts
Showing posts with label expression. Show all posts

Monday, March 19, 2012

Displaying RowCount from DataSet in Report TextBox

What is the expression for displaying the rowcount from a dataset in a textbox report item?

On a related note, if how can I access the error code I am sending back from Stored Proc using Return statement, to show up in a text box on report?

.. uspSomeStoredProc...

If error occured

Return -1

elseif some other error

Return 1

else

Return 0

End

Is there a way to display that? In general, how can the values that are returned by stored procs such as RowsAffected or some err code using RETURN or Output Variable be accessed in report? I don't see any properties exposed by datasets in the expression window for doing that.

Any input on this will be appreciated.

Thanks.

|||Any one? Any suggestions or input on this?

Wednesday, March 7, 2012

Displaying a zero instead of NULL

I am using the expression below to display a zero (number 0) instead of NULL
=IIF(ISNOTHING(SUM(FIELDS!Dis.Value)),0, SUM(FIELDS!Dis.Value))
Whats wrong in this ? It gives me a blank but NO ERROR ..
ThanksYou can't sum a Null value - it doesn't result in a null, just an error. You
need to say:
=Sum(IIf(IsNothing(Fields!Dis.Value),0,Fields!Dis.Value)
--
Brian Welcker
Group Program Manager
Microsoft SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
"Asim" <Asim@.discussions.microsoft.com> wrote in message
news:13D84407-7151-44BE-A276-A3D557FFFC95@.microsoft.com...
>I am using the expression below to display a zero (number 0) instead of
>NULL
> =IIF(ISNOTHING(SUM(FIELDS!Dis.Value)),0, SUM(FIELDS!Dis.Value))
> Whats wrong in this ? It gives me a blank but NO ERROR ..
> Thanks
>|||You could also use the ISNULL function to make nulls 0
SELECT ISNULL(FeildName,0) From TABLE
"Asim" <Asim@.discussions.microsoft.com> wrote in message
news:13D84407-7151-44BE-A276-A3D557FFFC95@.microsoft.com...
> I am using the expression below to display a zero (number 0) instead of
NULL
> =IIF(ISNOTHING(SUM(FIELDS!Dis.Value)),0, SUM(FIELDS!Dis.Value))
> Whats wrong in this ? It gives me a blank but NO ERROR ..
> Thanks
>|||Correct Anwer is:
=IIF(ISNOTHING(Sum(Fields!Dis.Value)),0,(Sum(Fields!Dis.Value)))
"Asim" wrote:
> I am using the expression below to display a zero (number 0) instead of NULL
> =IIF(ISNOTHING(SUM(FIELDS!Dis.Value)),0, SUM(FIELDS!Dis.Value))
> Whats wrong in this ? It gives me a blank but NO ERROR ..
> Thanks
>

Saturday, February 25, 2012

displaying % in value

Hi

I am calculating percentage using expression. I want to display % at the end of the result.

If I use P1 or P0 somehow it multiplies the result with 100 I guess.

Here is what my calculated value is

15.384515

and I want to display 15.38%

Using P1 or P0 I am getting 1,538.5%

How can I get the desired result?

Any help would be appreciated.

Regards

Amit

Yeah I always thought that was funny the way RS handles formating %.

You can try dividing your value by 100 and them formating it. I think the percent format requires a number between 0 and 1

e.d =format((field.value)/100,"P0")

that should give you "15%"

|||

You are great Nialhannon.

Thanks for your help. Your solution helped.

Regards

Amit

|||

I remember those issues, and I ended up doing the /100 in the dataset (or Stored Procs)

|||

Hi niallhannon,

I also have a similar problem in formatiing the data after rendering to excel.

The Field value is a percentage.

If there isn't any value zeros are getting displayed.

So if i use a format expression #,# (not to display anything in the cell),the percentage field is getting disturbed and is not getting displyed with two decimal places.

Kindly help me out in this issue.Its a bit urgent.

Thanks in advance

Nalini

displaying % in value

Hi

I am calculating percentage using expression. I want to display % at the end of the result.

If I use P1 or P0 somehow it multiplies the result with 100 I guess.

Here is what my calculated value is

15.384515

and I want to display 15.38%

Using P1 or P0 I am getting 1,538.5%

How can I get the desired result?

Any help would be appreciated.

Regards

Amit

Yeah I always thought that was funny the way RS handles formating %.

You can try dividing your value by 100 and them formating it. I think the percent format requires a number between 0 and 1

e.d =format((field.value)/100,"P0")

that should give you "15%"

|||

You are great Nialhannon.

Thanks for your help. Your solution helped.

Regards

Amit

|||

I remember those issues, and I ended up doing the /100 in the dataset (or Stored Procs)

Display textboxes depending on rendering format

I would like to display some textboxes depending on the rendering format. I
would like to write an expression like this in the Visibility.Hidden
=renderingFormat="Excel"
Is this possible?In case you are calling Reporting Services from your
Application then just pass an extra parameter from the UI
which has the Rendering Format value and then use the
value of this Textbox in the Report to determine Rendering
Format.
>--Original Message--
>I would like to display some textboxes depending on the
rendering format. I
>would like to write an expression like this in the
Visibility.Hidden
>=renderingFormat="Excel"
>Is this possible?
>.
>|||Eric:
I don't see a solution posted, but I have a similar need. Did you ever come
up with an answer to this?
Vince P
"Eric Quist" wrote:
> Thanks for your suggestion, but I have to support it even if the user uses
> the HtmlViewer and chooses to export the report from there.
>
> "Ravi" wrote:
> > In case you are calling Reporting Services from your
> > Application then just pass an extra parameter from the UI
> > which has the Rendering Format value and then use the
> > value of this Textbox in the Report to determine Rendering
> > Format.
> >
> > >--Original Message--
> > >I would like to display some textboxes depending on the
> > rendering format. I
> > >would like to write an expression like this in the
> > Visibility.Hidden
> > >=renderingFormat="Excel"
> > >
> > >Is this possible?
> > >.
> > >
> >|||I haven't found any good solution to this problem. I guess it must be added
to RS.
/Eric
"vmp_pdx" wrote:
> Eric:
> I don't see a solution posted, but I have a similar need. Did you ever come
> up with an answer to this?
> Vince P
> "Eric Quist" wrote:
> > Thanks for your suggestion, but I have to support it even if the user uses
> > the HtmlViewer and chooses to export the report from there.
> >
> >
> > "Ravi" wrote:
> >
> > > In case you are calling Reporting Services from your
> > > Application then just pass an extra parameter from the UI
> > > which has the Rendering Format value and then use the
> > > value of this Textbox in the Report to determine Rendering
> > > Format.
> > >
> > > >--Original Message--
> > > >I would like to display some textboxes depending on the
> > > rendering format. I
> > > >would like to write an expression like this in the
> > > Visibility.Hidden
> > > >=renderingFormat="Excel"
> > > >
> > > >Is this possible?
> > > >.
> > > >
> > >

Friday, February 24, 2012

display short datetime

Hi

I need to set the default value of an "End Date" parameter to the date of today.
Now I use the expression =Now(), but then the timestamp is also displayed. That I don't want to happen!

I tried formatting the datetime but then it becomes a string, and converting it back to a date leaves also a timestamp but with midnight time.

Is there a way to format a date parameter?

Hi,

Did you try : Format(mydate.Value,"dd/MM/yyyy") or Cdate(Format(mydate.Value,"dd/MM/yyyy").ToString) ?

Regards

Ayzan

|||

Both expressions above don't work because my parameter is of the type datetime and the expressions return a string. So I get an error that the parameter has another type than it expected.

Still thanks for pointing me the CDate function. It has alot of functions and that's the function that got me the wanted result.

To display only the date part of a datetime value retrieved by the function Now() you need the following expression:
=CDate(Now()).Today

Sunday, February 19, 2012

Display percentage % field and format

Hi,
In the group footer I want to show:
Total store with ABC systems is: 33% of Total stores
33% is a calculated field.
The expression for this is:
"Total store with ABC systems is: " & =Fields!A1.Value/Fields!B1.Value
& " of Total stores"
I merged 3 cells and put this expression is in one text box, this
output would be:
summary 0.33333333333 of Total stores
So I split the cell into three:
in first cell: Total store with ABC systems is:
in second cell: =Fields!A1.Value/Fields!B1.Value (format set to p0)
in third cell: of Total stores
but the width of percentage field is limited by the table column, so
the 33% would be either too far from the first cell or from the third
cell.
What can I do to concatenate them into one line without too much
space?
Thanks in advance.
DanniTry this: ="Percentage is " &
Format((Fields!A1.Value/Fields!B1.Value)/100.0, "p") & " of Total stores"
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Danni Liao" <danniliao@.yahoo.com> wrote in message
news:9d716b4a.0408231056.2d1b695e@.posting.google.com...
> Hi,
> In the group footer I want to show:
> Total store with ABC systems is: 33% of Total stores
> 33% is a calculated field.
> The expression for this is:
> "Total store with ABC systems is: " & =Fields!A1.Value/Fields!B1.Value
> & " of Total stores"
> I merged 3 cells and put this expression is in one text box, this
> output would be:
> summary 0.33333333333 of Total stores
> So I split the cell into three:
> in first cell: Total store with ABC systems is:
> in second cell: =Fields!A1.Value/Fields!B1.Value (format set to p0)
> in third cell: of Total stores
> but the width of percentage field is limited by the table column, so
> the 33% would be either too far from the first cell or from the third
> cell.
> What can I do to concatenate them into one line without too much
> space?
>
> Thanks in advance.
> Danni|||Or you could leave out the /100.0 and go to
Properties => Format => enter p2 for percent with a matissa of 2 places.
Bryan
"Ravi Mumulla (Microsoft)" wrote:
> Try this: ="Percentage is " &
> Format((Fields!A1.Value/Fields!B1.Value)/100.0, "p") & " of Total stores"
> --
> Ravi Mumulla (Microsoft)
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Danni Liao" <danniliao@.yahoo.com> wrote in message
> news:9d716b4a.0408231056.2d1b695e@.posting.google.com...
> > Hi,
> >
> > In the group footer I want to show:
> >
> > Total store with ABC systems is: 33% of Total stores
> >
> > 33% is a calculated field.
> >
> > The expression for this is:
> > "Total store with ABC systems is: " & =Fields!A1.Value/Fields!B1.Value
> > & " of Total stores"
> > I merged 3 cells and put this expression is in one text box, this
> > output would be:
> > summary 0.33333333333 of Total stores
> >
> > So I split the cell into three:
> > in first cell: Total store with ABC systems is:
> >
> > in second cell: =Fields!A1.Value/Fields!B1.Value (format set to p0)
> >
> > in third cell: of Total stores
> >
> > but the width of percentage field is limited by the table column, so
> > the 33% would be either too far from the first cell or from the third
> > cell.
> >
> > What can I do to concatenate them into one line without too much
> > space?
> >
> >
> > Thanks in advance.
> > Danni
>
>