Showing posts with label zero. Show all posts
Showing posts with label zero. Show all posts

Thursday, March 8, 2012

"Most Recent Notification Attempts" are Zero. Notification not occuring..

1. I have SQL 2005 Database Email Setup. The Test email works fine.

2. I have an operator setup, Operator name "X", email address is correct. Alerts are associated with Operator "X" and notification method=1.

3. I have an alert setup to monitor low disk space. The Alert seems to work, it appears to be firing. I am getting in properties -> History a positive occurence count. Response is set to "notify" operator "X" by email.

4. No email is received. Operator "X" history reveals that "Most recent notification events" -> By email "(Never emailed)"

Can anyone point me in the right direction here to troubleshoot ?

Cheers

s

You probably have more responses in another forum or newsgroup. This one is devoted to SQL Server Notification Services, which despite its similar name, is not the same as Alerts.

HTH...

"Most Recent Notification Attempts" are Zero. Notification not occuring..

1. I have SQL 2005 Database Email Setup. The Test email works fine.

2. I have an operator setup, Operator name "X", email address is correct. Alerts are associated with Operator "X" and notification method=1.

3. I have an alert setup to monitor low disk space. The Alert seems to work, it appears to be firing. I am getting in properties -> History a positive occurence count. Response is set to "notify" operator "X" by email.

4. No email is received. Operator "X" history reveals that "Most recent notification events" -> By email "(Never emailed)"

Can anyone point me in the right direction here to troubleshoot ?

Cheers

s

You probably have more responses in another forum or newsgroup. This one is devoted to SQL Server Notification Services, which despite its similar name, is not the same as Alerts.

HTH...

"lenght cannot be less than zero. Parameter name : lenght"

I'm using Visual Studio 2005, and when i try to drop a table from a data source( SQL Mobile database), to a new or existing form, always occors the error ""lenght cannot be less than zero. Parameter name : lenght"" , my project has more than one forms.
If i make the same steps on a new project with only one form, i can drop the same table without problems.
Anyone can help with this problem?

best regards,

Pedro Nogueira

Pedro,

It sounds like you are using the drag and drop data binding in a Windows Forms application using SQL Mobile as the data source?

First I recommend ensuring that you are running VS2005 Service Pack 1. If you are or still have this issue after upgrading, to recreate

this, we would need some insight into your database schema and how you are doing the drag and drop onto the form (are you dropping

the whole table? are you bound to a datagrid or to another control, etc)

What I'm saying is that I don't hear of anyone having problems with drag & drop of SQL Mobile/SQL CE tables onto forms with

VS2005 SP1, so you either have a bad install or have indeed found a bug. Happy to help you with that but would need more info

on your database and how you're doing the binding.

Darren Shaffer

Saturday, February 11, 2012

#Error using IIF and divide by zero

I am getting an error in a calculated field that could potentially divide by zero, even though I'm using an IIF. The column displays in the report as "#Error". My expression looks like this:

= IIF(Fields!Qty.Value = 0, "None", Fields!Hours.Value / Fields!Qty.Value)

I have successfully used this approach with INT fields, but this time the Hours field is a NUMERIC(9,2). My workaround is to do this:

IIF(Fields!Qty.Value = 0, "None", IIF(Fields!Qty.Value = 0, 42, Fields!Hours.Value) / Fields!Qty.Value)

I guess the 42 is cast to an INT inside the second IIF and the calculation works.

What's strange is that the division would even be carried out in the event of Qty = 0 from the first IIF, because the expression should just evaluate to "None" and that would be that.

Has anybody run into this problem? Is my workaround the recommended approach?

-Larry

Lawrence

Try

IIf(Fields!Income2.Value = 0, nothing,Fields!Income.Value/Fields!Income2.Value)

This works for me when my value is zero

Ham

|||

Hi Larry,

I recommend to add a custom code function for the division (in Report -> Report Properties -> Code):

Public Function Divide(ByVal first As Double, ByVal second As Double) As Double
If second = 0 Then
Return 0
Else
Return first / second
End If
End Function

Then, modify the expression accordingly:

= IIF(Fields!Qty.Value = 0, "None", Code.Divide(Fields!Hours.Value, Fields!Qty.Value))

-- Robert

|||

Thanks Robert, that's a good (dare I say) workaround. I'm still curious why the IIF errors out with the double division but works with integer division.

Also, the Edit Expression dialog has the "Divide" text underlined in red, but my project builds successfully and runs ok too. Any idea why it might think it's invalid?

-Larry

|||

Hi Ham,

Looks like I would still have to do two nested IIF statements -- one for my "None" message, and the other to return Nothing. I'm trying to avoid that. But the Code.Divide approach is working, so I'm on my way.

Thanks.

-Larry

#Error in total fields

I am getting a #error in my subtotal and total fields,
I have data in a field (on a table) as follows which displays 0.00 if there is a zero in the divide by field, otherwise it performs the divide and gives me a percentage difference from the two fields.
This works fine

=iif(Fields!REPCYINC.Value=0,0,(Fields!REPCYINC.Value) / iif(Fields!REPCYPROD.Value=0,1,Fields!REPCYPROD.Value)) * 100

Yet when i try to get this in a total field by doing an AVG it fails, and gives #error, please help, no matter how many iifs a wrap aroun dit it doesnt help.

This is the statement that #error's

=round(avg(iif(Fields!REPCYINC.Value=0,0,(Fields!REPCYINC.Value) / iif(Fields!REPCYPROD.Value=0,1,Fields!REPCYPROD.Value)) * 100) ,2)

Brian Weckler's blog has a posting related to this.

http://blogs.msdn.com/bwelcker/archive/2006/09/26/End-of-Amnesia-_2800_Avoiding-Divide-By-Zero-Errors_2900_.aspx

cheers,

Andrew

|||

Andy,

I had a similar issue recently when I used this statement:

Format(Sum(IIf(Fields!Product.Value="HEALTH",Fields!ID.Value,0)),"C")

Report Service kept giving me the #error, I located the detail error message and then I change my statement to this

Format(Sum(IIf(Fields!Product.Value="HEALTH",Fields!ID.Value,nothing)),"C") and everything worked okay. I remember the error message about mixing different types or something.

I hope this works for you.

Ham

|||

Unfortunately this post just explains what i have already posted, the issue is not the divide by zero, I have iif's to work around that and my inline divide give 0 result not #error,

I experience the #error in the group totals when i sum (As described in my original post)

If the main iif works and gives 0 then why not the sum?

These things should be straightforward!!

|||

That doesnt help, the inline iif *, 0, 0 works fine, I did try changing it to nothing although i still get the same issue, the group totals when i do a sum doesnt work, it #error's!!!

|||

sorted, regardless of how many iif's you throw around the numbers within the SSRS you MUST format the field as number otherwise #error occurs, seems like Microsft still have some work to do here.....

At LEAST make some kind of error handling reporting so we know where the error is coming from, it could be anything....

Thursday, February 9, 2012

#ERROR - avoid division by zero

Hi...
Need some help with creating reports in MS SQL Server Report Server and column name "Profit / Loss (%)".
Got an error when I try to run the code below.
The purpose is to avoid a division by zero... or do anyone know a better way solve this?

=IIF(SUM(Fields!RECOGNITION_REVENUE_RECOGNIZED.Value)=0 AND SUM(Fields!PROFIT_AND_LOSS_AMOUNT.Value)=0, 0, IIF(SUM(Fields!RECOGNITION_REVENUE_RECOGNIZED.Value)=0 AND SUM(Fields!PROFIT_AND_LOSS_AMOUNT.Value)<>0, -1, SUM(Fields!PROFIT_AND_LOSS_AMOUNT.Value)))
/
IIF(SUM(Fields!RECOGNITION_REVENUE_RECOGNIZED.Value)=0 AND SUM(Fields!PROFIT_AND_LOSS_AMOUNT.Value)=0, 1, IIF(SUM(Fields!RECOGNITION_REVENUE_RECOGNIZED.Value)=0 AND SUM(Fields!PROFIT_AND_LOSS_AMOUNT.Value)<>0, 1, SUM(Fields!RECOGNITION_REVENUE_RECOGNIZED.Value)))
Error message:
The value expression for the textbox ‘textbox86’ refers to the field ‘PROFIT_AND_LOSS_AMOUNT’. Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope.

//chwa

This error message is referring to the scope of the field ‘PROFIT_AND_LOSS_AMOUNT’. It cannot find it in the dataset. Try doing

SUM(Fields!PROFIT_AND_LOSS_AMOUNT.Value, "dataset name here")

for all those things above.