SSRS expression compilation: RequestMinimum is obsolete

Here is my SQL CODE:

CASE WHEN DATEDIFF(D,‘2015-02-07’,DATEADD(D, NUMOFDAYS,B.DELIVERYDATE)) >= 1 AND DATEDIFF(D,‘2015-02-07’,DATEADD(D, NUMOFDAYS,B.DELIVERYDATE))<= 7 THEN C.PURCHPRICE ELSE 0 END ‘-1 to -7 Days’

Now I create SSRS Report and Convert the sql code.

When I put this code in textbox expression…

=IIF(Datediff(“DD”,Now(),DateAdd(“DD”,Fields!NumOfDays.Value,Fields!DeliveryDate.Value)>= 1) AND Datediff(“DD”,Now(),DateAdd(“DD”,Fields!NumOfDays.Value,Fields!DeliveryDate.Value)<= 7) ,Fields!PurchPrice.Value,0)

then i got this error :

Error 1 An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC40000] ‘RequestMinimum’ is obsolete: ‘Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.’.’. ApAgeing.PrecisionDesign1 [Preview] 0 0

Anyone can help me?

When exactly do you get his error? Can you confirm that it disappears after removing this expression? (I want to be sure that it’s not caused by something else.)

When i put in textbox Expression then the error shown.

then when i remove it the report working fine and the data is showing.

To be sure: you mean that it happens already in the expression window, before even closing it, correct? (Please try to be more specific. You must realize that we can’t into your system.)

Hi Martin.

when i put this code in textbox:

=IIF(Datediff(“DD”,Now(),DateAdd(“DD”,Fields!NumOfDays.Value,Fields!DeliveryDate.Value)>= 1) AND Datediff(“DD”,Now(),DateAdd(“DD”,Fields!NumOfDays.Value,Fields!DeliveryDate.Value)<= 7) ,Fields!PurchPrice.Value,0)

then when i preview the report then the errow show…

Thanks. That’s what you should have said before.

Does it mean that the report compiles correctly and you get the error only when previewing it in VS?

yes sir…

but i already build the project and after that got the same error…

I think the error is on my code …

what do you think?

But you didn’t tell.us, even after I asked twice! I don’t have tīme to interrogate you all day - please start giving us much better answers if you want us to help you.

What’s the type of your field?

Also, you should learn to build smaller pieces first and then combine them, rather then writing a large piece of code and then having no idea what works and what doesn’t. Start with a trivial condition and add pieces one by one. It will tell you which part is to blame.

what do you mean what’s type of your field?

i also do that build first to smaller pieces…

You write the expression somewhere. I want to know where; the type of the thing.

If you did it in smaller pieces, then please tell us where exactly it fails. If you don’t know, please do it for real…

Hi Martin.

I got problem here DateAdd(“DD”,Fields!NumOfDays.Value,Fields!DeliveryDate.Value)>= 1)

then I got this error “SSRS expression compilation: RequestMinimum is obsolete”

and now I put quotation mark in “1” like this DateAdd(“DD”,Fields!NumOfDays.Value,Fields!DeliveryDate.Value)>= “1”)

after that I preview the report then the txtbox shows like this #Error, then Warning shows

“The Value expression for the textrun ‘Textbox8.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from string “1” to type ‘Date’ is not valid.”

then I remove the “>= 1” then the Answer shows is DATE ! which is wrong

Here is my formula:

IF DateToday - (Terms + Deliverydate) >= 1 AND DateToday - (Terms + Deliverydate) <= 7 then Price else 0 end

Step by step.

  1. Terms + Deliverydate = Due date

  2. Datetoday - due date = DaysLeft

  3. DaysLeft >= 1 and <= 7

EXAMPLE:

Data type : Terms (Integer) , Deliverydate( Date)

  1. 30 + 12/27/2015 = 1/26/2016

  2. 1/19/2016 - 1/26/2016 = 7 days left

  3. 7 days left >=1 and <= 7 = TRUE

NOW MY PROBLEM IS I NEED TO GET INTERGER VALUE???

HOW CAN I CONVERT IT ?

ANY CLARIFICATION SIR?

Could you please explain what you expect your code to do? It makes no sense to me. DateAdd() returns a date and you’re trying to compare it first with an integer and then with a string…

tnx for the time

but i already solve my problem.

using this code.

=IIF(DateDiff(“d” ,Now(), Dateadd(“d”,Fields!NumOfDays.Value,Fields!DeliveryDate.Value) ) >= 1 and DateDiff(“d” , Dateadd(“d”,Fields!NumOfDays.Value,Fields!DeliveryDate.Value), Now() ) <= 7, CDbl(Fields!PurchPrice.Value), CDbl(0))