the IIF is a very special "command" since it actually not a function like the normal IF. The problem is that both the expression on the true and false side are evaluated, and that you can't set a value there.
Here you can find more information about the IIF Function:
There are also thousands of discussion threads in the internet.
To solve the problem one solution is to write your own code like this:
Function checkValue(ByVal x As Integer) As Object
If x = 30 Then
checkValue = 2
ElseIf x = 10 Then
checkValue = 2.4
checkValue = "Not applicable"
You can then use this function in an RDL expression:
You need to replace $value$ with the expression / numeric field like Compound_Amount etc....
You need to manually add this code snippet to the RDL file (at the bottom):
The new OpenLAB Data Analyisis allows to add code directly into the report templates properties.
Here another idea from our R&D engineer for #2:
A : =Iif(x=30, 2, Iif(x=10, 2.4, "Not applicable"))
the A: is not part of the expression but indcaates that you can save the value of teh expression in a variable in IR,
The important part is: You cannot set a variable in the true / false part if the IIF expression, you just return the value to save it later- Hope this helps.
Could you please set the flag the question as answered if it worked for you?
I updated the tags on this thread to make it easier to search.
1 person found this helpful
we calculate the AV for evaluating content uniformity as follows:
k-value is selected via a report parameter
X value and s value are calculated using actual analytical data, of course (statistical evaluation of the respective aggregators
Calculation of M-Value:
M: IIF(ROUND(avg(X),1)>101.5,101.5,"") & IIF(ROUND(avg(X),1)<98.5,98.5,"") & IIF(Round(avg(X),1)>=98.5 AND ROUND(avg(X),1)<=101.5,round(avg(X),1),"")
Using the calculated M Value, the AV-Value is calculated
rounding to the appropriate digits is important in this case.