Anyone know why the following expression would make my cell just say "#ERROR"?
=IIf(Sum(Fields!curr.Value) = 0, 0, Sum(Fields!due.Value) / Sum(Fields!curr.Value))
Is it not short circuiting so it still hits the division by zero? If so, would there be a way around this?
Microsoft thinks they are smarter than you and are checking for a divide by zero even though you'll never hit it because of your logic.
The Trick (i.e. Workaround for Microsoft's propensity for "helping" and making things worse) is to use another IIF:
=IIf(Sum(Fields!curr.Value) = 0, 0, Sum(Fields!due.Value)) / IIF(Sum(Fields!curr.Value) = 0, 1, Sum(Fields!curr.Value))
SSRS Expression Divide by Zero Error
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/ef1a0375-414e-41f4-b32f-3b782c5b4c85/error-using-iif-and-divide-by-zero?forum=sqlreportingservices
Related
I have the following line of code that sets a String.Index to a certain value using the index offset function in the swift standard library
index = str.(index, offsetBy: -length)
it functions for short str, but as soon as it, or the length value get above some arbitrary (and changing!) threshold, I get a variety of crashes. Most consistently, and from a break point is
Swift/UnsafeBufferPointer.swift:913: Fatal error
I have done a little research plus my own testing and have not found anything conclusive so far. The most helpful test I ran was trying to offset this index in smaller increments with a loop such as with the following code
for _ in 0...Int(totalLength) {
let newIndex = str(index, offsetBy: -1)
index = newIndex
}
however, the let newIndex line still crashed even with the offset value at 1, so I imagine that it is the cause of the long string. However, with this test I was more consistently getting BAD ACCESS errors instead of the UnsafeBufferPointer.
I have not found anyone online who has run into a similar problem, and am wondering if this is a documented issue with the function, or if there is some other thing at fault. Any help is appreciated, thank you !
I have recorded a script in LR11.5 version using Winsocket protocol (Only protocol I was able to use to record my application). I want to correlate few receive buffers. In one such buffer I have two values to correlate, given that both are same values. Buffer is as below :-
recv buf30 136
"&SOT&148\vF.USER\vSK1\vTIME.OUT.MINUTES&EOT&&START&148\v3\v999&END&&START&"
"99\v56\v28 FEB 2016\vSK1\v8298,\v28 FEB 2016 16:23\vg15.0.00\vr11.000&END&"
The high lightened values are the one that I need to correlate. What should I do for this. I have used to lrs_save_param() function for correlation.
The correlation API you need depends on the network protocol recorded in your script. If it uses constant offsets of fields, you can safely use lrs_save_param. The result of correlation would be something like this:
lrs_save_param("socket0", LRS_LAST_RECEIVED, "param1", 16, 3);
lrs_save_param("socket0", LRS_LAST_RECEIVED, "param2", 138, 3);
(Zero-based offset, length of the value.)
But if the offsets vary from run to run, the situation is more complicated: you'll have to specify boundaries for the extracted values. For instance:
lrs_save_searched_string("socket0", LRS_LAST_RECEIVED, "param1", "LB/BIN=\v", "RB/BIN=\v",
2, 0, -1);
lrs_save_searched_string("socket0", LRS_LAST_RECEIVED, "param2", "LB/BIN=\v", "RB/BIN=\v",
8, 0, -1);
(Left and right boundary, 1-based number of occurrence, offset from the left boundary, length, which is autodetected in this case.)
Please check the official documentation for details.
I'm unsure how to write an optimization statement in clingo4 (ASP solver).
I want to minimize the total number of instances of certain literals in each answer set.
I'm simulating a fire-response agent in ASP. The agent can choose to perform certain simple actions at different times, such as:
0{call_fire_department(Area, Time, Time+1)}1:- [preconditions].
0{send_security_guard(Guard, Area, Time, Time+1)}1:- [preconditions].
0{activate_fire_suppression(Area, Time, Time+1)}1:- [preconditions].
The agent has goals, which require a mix of the above actions, at specific times. I want to minimize the number of instances of each of the above, while still achieving the agent goals.
How do I write an appropriate optimization statement? (I'm assuming I will need a 'minimize' statement).
Thanks.
How about
#minimize{
1, call, Area, Time : call_fire_department(Area, Time, Time+1) ;
1, send, Guard, Area, Time : send_security_guard(Guard, Area, Time, Time+1) ;
1, activate, Area, Time : activate_fire_suppression(Area, Time, Time+1)
}.
1 means count 1 towards the fact
Tag (call, send, activate), Guard, Area and Time make sure each fact is counted. E.g. without the tag activate_file_suppression(foo, 20, 21) and call_fire_department(foo, 20, 21) would be merged in the set.
When I create a new quote from Epicor I would like to add an item from the parts form automatically.
I am trying to do this using the following ABL code which runs when 'GetNewQuoteHed' is called:
run Update.
run GetNewQuoteDtl.
run ChangePartNumMaster("Rod Tube").
ttQuoteDtl.OrderQty = 5.
run Update.
I am getting the error:
Index -1 is either negative or above rows count.
This error occurs for each line in my ABL code.
What am I doing wrong?
That's not the proper format for a 4GL error message (nor is it at all familiar) so I'd say it is an Epicor application message. Epicor support is probably your best bet. However... Just guessing but it sounds like you might need to somehow initialize the thing that you're updating.
Agree with #Tom, but i would also say try and isolate the error and see where the error is raised as soon as you find the point the error is actually raised it is normally much easier to figure out exactly what is going wrong and how to solve it.
Working between a 0 based and a 1 based system there can be issues with the 1st or last entry depending on which way you moving. As the index for 0 based systems starts at 0 and ends at n-1 where 1 based systems start at 1 and end at n.
This seems like it should be straight forward, but I'm seeing some strange behavior. I'm attempting to color code my tasks based on a flag. It appears to be correctly coloring the tasks, but at some point in the processing the initial tasks that were colored are getting reset to black. The task that it happens on seems to be fairly inconsistent too. Here's how I'm trying to perform this task (simplified to it's barest form):
Sub ColorTasks()
Dim t As Task
For Each t In ActiveProject.Tasks
SelectRow t.ID, RowRelative:=False
Font32Ex Color:=2366701
Next
End Sub
This code seems to work just fine for smaller data sets, but this project contains around 2,000 tasks. Any ideas?
Yes I too am having a similar problem::
For Each t In tsks
Select Case t.Text1
Case "COMPLETE"
SelectRow Row:=t.ID, RowRelative:=False
Font32Ex CellColor:=&659B59
Case "NOT STARTED"
SelectRow Row:=t.ID, RowRelative:=False
Font32Ex CellColor:=&862525
Case "IN PROGRESS"
SelectRow Row:=t.ID, RowRelative:=False
Font32Ex CellColor:=&3A3AD4
End Select
Next t
According to: http://msdn.microsoft.com/en-us/library/ff863572.aspx this should work, yet I get syntax errors every time. Only way I can get this to work is if I use the FontEx method which limits me to only 16 colors....
I know that this is an old question but I hope it may be useful for someone with similar problem.
The mistake is that you've forgotten to add 'H' before hexadecimal number, so properly there should be:
Font32Ex CellColor:=&H3A3AD4
etc
I find it easier to use RGB values.
Font32Ex CellColor:=RGB(255, 199, 206) 'Changes fill
Font32Ex Color:=RGB(156, 0, 6) ' Changes font color
Using your code, I turned my entire sheet to red on pink, 350 tasks. I don't have a means to test it on 2000 though without a lot of extra work.