Search code examples
sqlreporting-servicessql-server-2008-r2ssrs-2008

SQL Report Builder time(0) and int in IIF expression


I have two datasets which are returning 2 values, one is a duration of a step in our process (time(0) e.g. 00:05:32) and the other is the setpoint for the duration in seconds(int e.g. 900 seconds). I need to compare these two and to write a 'OK' or 'NOK' in a column if the actual duration is shorter/longer then the set duration. My problem is actually converting one value to the type of the other value so I can do a comparison between the two(in a IIF expression). I have no influence over the stored procedures and can only work in the Report builder itself. Can anyone help me out?


Solution

  • I found the solution! The trick was to convert both variables to datetime. int as well as time(0)

    Following expression worked for me.

    =IIF((DateAdd("s", 0, "00:00:00") + Fields!Time.Value) > DateAdd("s", Fields!TimeSecondsInt.Value, "00:00:00"), "OK", "NOK")