Showing posts with label displaying. Show all posts
Showing posts with label displaying. Show all posts

Thursday, February 16, 2012

Average Functionality issue

Hi All,

In my Report using SSRS 2005, I am displaying data using table and this table has table footer in which I am calculating "average" using Avg() function.The values in table rows can be either floating numbers (for eg; -1,-99,5.005) or "N/A". I use the following function to calculate Average
=Avg(Iif(Fields!Channel1.Value="N/A",CDbl("0"),CDbl(Fields!Channel1.Value)),"MainDS")

where "Fields!Channel1.Value" are values in table rows.

Everything works fine if all the table rows are floating point numbers and not "N/A", but as soon as table rows values are "N/A" I encounter "#Error" in the table footer.

Can anyone figure out how to get this code working. Thanks in advance.

Regards,
abhi_viking

the best way is add another field in the dataset. Populate this field with the same value after converting to float and replace those "N/A" with 0. Now, you should be able to use the "Avg" function on this new field which is of float data type.

|||Hi,

Thanks for replying. I am currently doing the same thing using "Iif" in Avg()

=Avg(Iif(Fields!Channel1.Value="N/A",CDbl("0"),CDbl(Fields!Channel1.Value)),"MainDS")

If the value is "N/A", then value is 0, else the value is converted to Double ie; CDbl(Fields!Channel1.Value)

Any Idea how to get this code working.

Regards,
abhi_viking
|||

Pls try,

=avg(iif(IsNumeric(Fields!Channel1.Value),cdbl(Fields!Channel.Value),cdbl(0)))

Priyank

|||I tried using IsNumeric(), but didnt work for me, I got the same error that I used to get Sad
Is there any other way to get this code working ?

Regards,
abhi_viking

|||

First create an new expression to just convert the "N/A" to 0. Then create another epression and do the average of the first expression. I think this should work, if not could you give te details of the error?

|||

The problem is that the IIF statement evaluates both the true and false results (http://msdn2.microsoft.com/en-us/library/27ydhh0d(VS.80).aspx) and DBbl("N/A") fails to evaluate. Perhaps you could try:

Code Snippet

=Avg(

CDbl(

IIF(

Fields!=Channel1.Value="N/A",

0,

Fields!=Channel1.Value

)

)

)

If you still have problems, create a small custom function and pass the value into it and let it return the double. Within the code fragment, you can use a real IF and avoid the problems imposed by IIF.

Larry

|||

Thank you guys for replying back, I will try your suggestions soon and will keep you updated on this topic.

Regards,

abhi_viking

|||Thanks Larry, your code snippet works for me Smile

Average Functionality issue

Hi All,

In my Report using SSRS 2005, I am displaying data using table and this table has table footer in which I am calculating "average" using Avg() function.The values in table rows can be either floating numbers (for eg; -1,-99,5.005) or "N/A". I use the following function to calculate Average
=Avg(Iif(Fields!Channel1.Value="N/A",CDbl("0"),CDbl(Fields!Channel1.Value)),"MainDS")

where "Fields!Channel1.Value" are values in table rows.

Everything works fine if all the table rows are floating point numbers and not "N/A", but as soon as table rows values are "N/A" I encounter "#Error" in the table footer.

Can anyone figure out how to get this code working. Thanks in advance.

Regards,
abhi_viking

the best way is add another field in the dataset. Populate this field with the same value after converting to float and replace those "N/A" with 0. Now, you should be able to use the "Avg" function on this new field which is of float data type.

|||Hi,

Thanks for replying. I am currently doing the same thing using "Iif" in Avg()

=Avg(Iif(Fields!Channel1.Value="N/A",CDbl("0"),CDbl(Fields!Channel1.Value)),"MainDS")

If the value is "N/A", then value is 0, else the value is converted to Double ie; CDbl(Fields!Channel1.Value)

Any Idea how to get this code working.

Regards,
abhi_viking
|||

Pls try,

=avg(iif(IsNumeric(Fields!Channel1.Value),cdbl(Fields!Channel.Value),cdbl(0)))

Priyank

|||I tried using IsNumeric(), but didnt work for me, I got the same error that I used to get Sad
Is there any other way to get this code working ?

Regards,
abhi_viking

|||

First create an new expression to just convert the "N/A" to 0. Then create another epression and do the average of the first expression. I think this should work, if not could you give te details of the error?

|||

The problem is that the IIF statement evaluates both the true and false results (http://msdn2.microsoft.com/en-us/library/27ydhh0d(VS.80).aspx) and DBbl("N/A") fails to evaluate. Perhaps you could try:

Code Snippet

=Avg(

CDbl(

IIF(

Fields!=Channel1.Value="N/A",

0,

Fields!=Channel1.Value

)

)

)

If you still have problems, create a small custom function and pass the value into it and let it return the double. Within the code fragment, you can use a real IF and avoid the problems imposed by IIF.

Larry

|||

Thank you guys for replying back, I will try your suggestions soon and will keep you updated on this topic.

Regards,

abhi_viking

|||Thanks Larry, your code snippet works for me Smile

Average Functionality issue

Hi All,

In my Report using SSRS 2005, I am displaying data using table and this table has table footer in which I am calculating "average" using Avg() function.The values in table rows can be either floating numbers (for eg; -1,-99,5.005) or "N/A". I use the following function to calculate Average
=Avg(Iif(Fields!Channel1.Value="N/A",CDbl("0"),CDbl(Fields!Channel1.Value)),"MainDS")

where "Fields!Channel1.Value" are values in table rows.

Everything works fine if all the table rows are floating point numbers and not "N/A", but as soon as table rows values are "N/A" I encounter "#Error" in the table footer.

Can anyone figure out how to get this code working. Thanks in advance.

Regards,
abhi_viking

the best way is add another field in the dataset. Populate this field with the same value after converting to float and replace those "N/A" with 0. Now, you should be able to use the "Avg" function on this new field which is of float data type.

|||Hi,

Thanks for replying. I am currently doing the same thing using "Iif" in Avg()

=Avg(Iif(Fields!Channel1.Value="N/A",CDbl("0"),CDbl(Fields!Channel1.Value)),"MainDS")

If the value is "N/A", then value is 0, else the value is converted to Double ie; CDbl(Fields!Channel1.Value)

Any Idea how to get this code working.

Regards,
abhi_viking
|||

Pls try,

=avg(iif(IsNumeric(Fields!Channel1.Value),cdbl(Fields!Channel.Value),cdbl(0)))

Priyank

|||I tried using IsNumeric(), but didnt work for me, I got the same error that I used to get Sad
Is there any other way to get this code working ?

Regards,
abhi_viking

|||

First create an new expression to just convert the "N/A" to 0. Then create another epression and do the average of the first expression. I think this should work, if not could you give te details of the error?

|||

The problem is that the IIF statement evaluates both the true and false results (http://msdn2.microsoft.com/en-us/library/27ydhh0d(VS.80).aspx) and DBbl("N/A") fails to evaluate. Perhaps you could try:

Code Snippet

=Avg(

CDbl(

IIF(

Fields!=Channel1.Value="N/A",

0,

Fields!=Channel1.Value

)

)

)

If you still have problems, create a small custom function and pass the value into it and let it return the double. Within the code fragment, you can use a real IF and avoid the problems imposed by IIF.

Larry

|||

Thank you guys for replying back, I will try your suggestions soon and will keep you updated on this topic.

Regards,

abhi_viking

|||Thanks Larry, your code snippet works for me Smile

Average Functionality issue

Hi All,

In my Report using SSRS 2005, I am displaying data using table and this table has table footer in which I am calculating "average" using Avg() function.The values in table rows can be either floating numbers (for eg; -1,-99,5.005) or "N/A". I use the following function to calculate Average
=Avg(Iif(Fields!Channel1.Value="N/A",CDbl("0"),CDbl(Fields!Channel1.Value)),"MainDS")

where "Fields!Channel1.Value" are values in table rows.

Everything works fine if all the table rows are floating point numbers and not "N/A", but as soon as table rows values are "N/A" I encounter "#Error" in the table footer.

Can anyone figure out how to get this code working. Thanks in advance.

Regards,
abhi_viking

the best way is add another field in the dataset. Populate this field with the same value after converting to float and replace those "N/A" with 0. Now, you should be able to use the "Avg" function on this new field which is of float data type.

|||Hi,

Thanks for replying. I am currently doing the same thing using "Iif" in Avg()

=Avg(Iif(Fields!Channel1.Value="N/A",CDbl("0"),CDbl(Fields!Channel1.Value)),"MainDS")

If the value is "N/A", then value is 0, else the value is converted to Double ie; CDbl(Fields!Channel1.Value)

Any Idea how to get this code working.

Regards,
abhi_viking
|||

Pls try,

=avg(iif(IsNumeric(Fields!Channel1.Value),cdbl(Fields!Channel.Value),cdbl(0)))

Priyank

|||I tried using IsNumeric(), but didnt work for me, I got the same error that I used to get Sad
Is there any other way to get this code working ?

Regards,
abhi_viking

|||

First create an new expression to just convert the "N/A" to 0. Then create another epression and do the average of the first expression. I think this should work, if not could you give te details of the error?

|||

The problem is that the IIF statement evaluates both the true and false results (http://msdn2.microsoft.com/en-us/library/27ydhh0d(VS.80).aspx) and DBbl("N/A") fails to evaluate. Perhaps you could try:

Code Snippet

=Avg(

CDbl(

IIF(

Fields!=Channel1.Value="N/A",

0,

Fields!=Channel1.Value

)

)

)

If you still have problems, create a small custom function and pass the value into it and let it return the double. Within the code fragment, you can use a real IF and avoid the problems imposed by IIF.

Larry

|||

Thank you guys for replying back, I will try your suggestions soon and will keep you updated on this topic.

Regards,

abhi_viking

|||Thanks Larry, your code snippet works for me Smile

Sunday, February 12, 2012

Auto-Refresh for SQL Grids displaying SQL Server Data

Functionallity of the Application--

"We have a large legacy application using SQL Server 2000. We're gradually adding .NET WinForms controls to it, using the IdeaBlade DevForce package as the data access layer, and primarily Infragistics Grids and other controls for display. We're using Visual Studio 2005, and plan to migrate to SQL Server 2005 pending validation, but I need a solution that works for 2000."

Problem description--

"I would like a mechanism to allow grid displays to automatically update when any change is made to one of the tables that contributes data to it. I'd like the mechanism to be event driven using some kind of publish/subscribe model. "

Challenges-

"Instead of using notification services ,any triggers or extended stored procedures if suffice this issues ,help me out in this regard."

Of course, Query Notifications in SS2005 will be of great interest to you. But that doesn't help in the meantime.

ASP.NET 2.0 has some cache notifications for SQL Server 2000 that you may want to check out as being something you can tweak to fit your needs. Here are a couple of articles that may help.

http://www.c-sharpcorner.com/UploadFile/mosessaur/sqlcachedependency01292006135138PM/sqlcachedependency.aspx?ArticleID=3caa7d32-dce0-44dc-8769-77f8448e76bc

http://www.15seconds.com/issue/040518.htm

You can use SSNS for this, but it'll require that you develop a custom delivery protocol to notify the client app.

HTH...

Joe

Auto-Refresh for SQL Grids displaying SQL Server Data

Functionallity of the Application--

"We have a large legacy application using SQL Server 2000. We're gradually adding .NET WinForms controls to it, using the IdeaBlade DevForce package as the data access layer, and primarily Infragistics Grids and other controls for display. We're using Visual Studio 2005, and plan to migrate to SQL Server 2005 pending validation, but I need a solution that works for 2000."

Problem description--

"I would like a mechanism to allow grid displays to automatically update when any change is made to one of the tables that contributes data to it. I'd like the mechanism to be event driven using some kind of publish/subscribe model. "

Challenges-

"Instead of using notification services ,any triggers or extended stored procedures if suffice this issues ,help me out in this regard."

Of course, Query Notifications in SS2005 will be of great interest to you. But that doesn't help in the meantime.

ASP.NET 2.0 has some cache notifications for SQL Server 2000 that you may want to check out as being something you can tweak to fit your needs. Here are a couple of articles that may help.

http://www.c-sharpcorner.com/UploadFile/mosessaur/sqlcachedependency01292006135138PM/sqlcachedependency.aspx?ArticleID=3caa7d32-dce0-44dc-8769-77f8448e76bc

http://www.15seconds.com/issue/040518.htm

You can use SSNS for this, but it'll require that you develop a custom delivery protocol to notify the client app.

HTH...

Joe