Hey guys,
i m currently working on an quiet complex report. The Goal i would like to achieve is at first quiet simple. The report has several columns. Some of them are supposed to give an calculated Percentage as a Difference to the current value.
with a simple variable I am now trying to simple cut anything above and below 200% and replace it with a string from the variable >=200% or <=200%. It works completly fine with the test data set and I am therefore quiet confident, that the actual set up of the variable does not cause the Issue.
However, with the actual report he does not allow me to set the variable. He returns "invalid case function" with the following error message:
RSV-VAL-0002
INVALID CASE
when [qry_Crosstab].[Delta_Plan-PrevYear(rel)] =2 THEN 2
when [qry_Crosstab].[Delta_Plan-PrevYear(rel)] =-2 THEN -2
END, CRX,API-00003 Near or at the Position '556#39;
END', data value error. Operators ('string(varchar),integer')fort he Operator 'Equal(0)' are not compatible.
The Data format is set to"%"
Since that exact case function works at the other reports fine, I come to the comclusion that the actual calculation within the data-element must cause the problem. But that is a simple calculation which, in my opinion can not cause that error. Furthermore I tested similar calculations in Test-Reports and it works just fine in combination with the varibale.
Any help is much appreciated
THanks
Philip
When using case or if then else, all possible outputs must be of the same data type. You cannot have something that in one case, it returns a float, and in another case, it returns a string.
Thus, I would suggest you have one item be your regular calculation without limiting to -2 or +2, and in another item, you manually build the string from that value.
Note that'll only work in a list container, not in a crosstab. I think it could be done in a crosstab as well, but that's somewhat hacky... :(
Hey, thanks for the response.
so basically i d have to do a "in between" step to make the variable work?
Would it work in a crosstab with "define Content"? Would be a lot of manuel work since i d have to define every single cell but should work then, shouldn't it?
Cheers
I guess I was wrong, you *can* insert such a string into a crosstab; see screenshot attached.
The definition of [profit string] in there is:
case
when [profit%] < 0.7 then '< 70%'
when [profit%] > 0.8 then '> 80%'
else cast( [profit%]*100, integer ) || '%'
end