I'm currently experiencing
The Value expression for the textrun ‘Textbox137.Paragraphs[0].TextRuns[0]’ contains an error: [BC30198] ')' expected.
=(Variables!Seconds.Value <= 500,"PASS", "FAIL") OR (Variables!Seconds.Value < 0,"N/A","")
This is a results column. In event that seconds is negative number it will be N/A. which means anything less then 0.
any thoughts on my syntax.
Not really sure where to begin with this as the syntax is almost entirely wrong, unfortunately. From my best inference, I am guessing you want N/A if less than 0, PASS if less than or equal to 500, and FAIL for anything above that. I'm also not sure why you're using variables rather than populating your data with a query and using the Fields!... syntax, but that's another issue entirely. To fix your current issue, you've neglected to include the IIF function that you seem to be trying to use. I think the expression you'll want is the following.
=IIF(Variables!Seconds.Value < 0, "N/A", IIF(Variables!Seconds.Value <= 500, "PASS", "FAIL"))
This will first check the variable to see if it is less than 0, printing N/A if so. If false, it will evaluate the second IIF that will print PASS for less than 500 and FAIL for anything above 500.
Related
Why can't you do this if you try to find out whether an int is between two numbers:
if (16.5 < value < 17.5)
Instead of it, you'll have to do
if (value > 16.5 && value < 17.5)
which seems like a bit of overhead.
short answer
you can make own method like
between(value, 1, 10);
long answer
you have to think about how the compilor works.
first. they have a some kind of parser that reads program language.
if you write 'if' conditional. a parsor read 'i' and 'f' character. then expect '(' sign.
if ( a > b )
check value, check sign, check value again, and check ')' sign.
The program then knows that this is a conditional statement. then make machine code like 01010101(idk. but we can't read something).
In this fomular. Finally comparing the values is one by one(The compiler will work in the smallest unit possible).
Efficiency is very important at this stage. come back your code.
if (16.5 < value < 17.5)
and how about this?
if (16.5 < value > 17.5)
and how about?
if (16.5 > value < 17.5)
this is have many exception. But dart might be able to make this syntax. but they won't.
Because they too have to do the work of comparing one by one.
so you can make own method.
Try the following code:
if (value.clamp(16.6, 17.4) == value) {
// Do what you want to do
}
I think the .clamp function is to check if a number is less than the lower bound (16.6) or greater than the upper bound (17.4) or between the lower bound and the upper bound. If the number is less than the lower limit or greater than the upper limit, then display the lower or upper limit, otherwise display the number (I know by testing in DartPad)
I am using clingo to solve a homework problem and stumbled upon something I can't explain:
normalized(0,0).
normalized(A,1) :-
A != 0.
normalized(10).
In my opinion, normalized should be 0 when the first parameter is 0 or 1 in every other case.
Running clingo on that, however, produces the following:
test.pl:2:1-3:12: error: unsafe variables in:
normalized(A,1):-[#inc_base];A!=0.
test.pl:2:12-13: note: 'A' is unsafe
Why is A unsafe here?
According to Programming with CLINGO
Some error messages say that the program
has “unsafe variables.” Such a message usually indicates that the head of one of
the rules includes a variable that does not occur in its body; stable models of such
programs may be infinite.
But in this example A is present in the body.
Will clingo produce an infinite set consisting of answers for all numbers here?
I tried adding number(_) around the first parameter and pattern matching on it to avoid this situation but with the same result:
normalized(number(0),0).
normalized(A,1) :-
A=number(B),
B != 0.
normalized(number(10)).
How would I write normalized properly?
With "variables occuring in the body" actually means in a positive literal in the body. I can recommend the official guide: https://github.com/potassco/guide/releases/
The second thing, ASP is not prolog. Your rules get grounded, i.e. each first order variable is replaced with its domain. In your case A has no domain.
What would be the expected outcome of your program ?
normalized(12351,1).
normalized(my_mom,1).
would all be valid replacements for A so you create an infinite program. This is why 'A' has to be bounded by a domain. For example:
dom(a). dom(b). dom(c). dom(100).
normalized(0,0).
normalized(A,1) :- dom(A).
would produce
normalize(0,0).
normalize(a,1).
normalize(b,1).
normalize(c,1).
normalize(100,1).
Also note that there is no such thing as number/1. ASP is a typefree language.
Also,
normalized(10).
is a different predicate with only one parameter, I do not know how this will fit in your program.
Maybe your are looking for something like this:
dom(1..100).
normalize(0,0).
normalize(X,1) :- dom(X).
foo(43).
bar(Y) :- normalize(X,Y), foo(X).
I am trying to create a service that varies depending on the resources that are used.
For example if a nurse were to carry out the service it could take 10 - 35 mins, whereas if this is carried out by another member of staff it could take 5-25 minutes.
I have had a go - as in the picture below, however, what I've written doesn't seem to be working.
Resource dependent delays
Any help would be massively appreciated!
First, since the parameter "Delay time" accepts a value, you need to replace if-else statement with conditional expression "? :". The syntax is the following: condition ? value if true : value if false.
Moreover, your should use another condition to check if the agent has a resource unit from "Nurse":
agent.resourceUnitOfPool(Nurse) != null ? triangular(10, 15, 35) :
triangular(5, 10, 25)
I have the following suppression formula in the details section:
{JCJM.udRough} <= #1/1/2013 12:00#
AND
{JCJM.udTrim} <= #1/1/2013 12:00#
and it works. However, I also need it to suppress if the udRough or udTrim field is blank. When I try to add
OR {JCJM.udRough}=""
it says that a date-time is expected where the blank quotes are.
Can someone please help?
As a general rule in CR, if a field can be null then you should explicitly check for that case first in a formula, otherwise it will not evaluate properly. Otherwise, CR will treat it like an unhandled exception.
So in your case, CR is short-circuit evaluating the expression {JCJM.udRough}<=#1/1/2013 12:00# as the very first thing, sees that the field is null, and stops evaluating the rest of the formula since it has encountered an exception.
What you need is:
(isnull({JCJM.udRough}) or {JCJM.udRough} <= #1/1/2013 12:00#)
and (isnull({JCJM.udTrim}) or {JCJM.udTrim} <= #1/1/2013 12:00#)
Try
if ISNULL({JCJM.udRough})
Then true
else false
This is from my understanding from your question if you are searching for something different let me know will try to answer it.
I have a simple formula in crystal syntax which looks something like this :
if isdate(totext({Absence Details.Return to Work Interview Date})) = true
and {Absence Details.Return to Work Interview required} = true then
1
else
0;
This is the actual code of the formula
but the else part is never getting executed, when the condition is not true report just shows blank. I am not sure what I am doing wrong here.
Thanks in Advance.
- Amit
Maybe you have some null value in your fields - in such case crystal just returns null. You then need either "convert null values to default" setting for report or explicit testing against nulls.
Edit: NM, code was posted to the comments. Doesn't look like this is the issue.
My guess, assuming you've debugged correctly is that you've got a semicolon somewhere you shouldn't.
if {something} = x then
do something;
else
do something different;
instead of
if {something} = x then
do something
else
do something different;
This would cause the behaviour, assuming it doesn't choke on the orphaned else clause. But as the comments say, short of posting real code, we can only guess at what's going on. It could be as simple as your evaluation is always true.
Change the 0 to a 7 and see if it actually prints 7. Some report generation tools (and I have little experience with Crystal but quite a bit with others) will leave fields blank if they're zero - this often helps in reading the report by reducing unnecessary clutter.
If the 7's print out, then that's what the problem is, and it's a matter of figuring out how to get Crystal to output an actual 0.
That may be a matter of configuring the output field or even stting it to a textual "0" instead of numeric 0.
Of course, if that doesn't print out 7's, then feel free to let me know.