locked
SSRS IIF Statement with LOOKUP RRS feed

  • Question

  • User-2112117666 posted

    It is my IIF statement

    =IIF(Year(Fields!Date.Value) <= 2015 AND Month(Fields!End_Date.Value) <= 02 AND Lookup(Fields!Project.Value,Fields!Project.Value,Fields!company.Value, "ds_Projects")="ABC", "Available", "No")


    when i run report i get #ERROR in my table cells but when i run my expression without Lookup Fields it run good... but lookup fields are necessary plz help me
    Thursday, December 11, 2014 2:57 AM

Answers

  • User-830595639 posted

    Ok, so if both of your expression are running fine separately then try to do like this.

    1. take two different text box in your report. 

    2. Put both expression separately in both text boxes.

    3. Then write a final expression like below

    IIF(ReportItems!Textbox1.Value ="ABC" OR ReportItems!Textbox2.Value = "XYZ","Available", "No")

    Here Textbox1 and Textbox2 are the name of the text boxes.

    Hope this will help you.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 12, 2014 7:36 AM

All replies

  • User-830595639 posted

    Hi,

    Your expression looks correct to me, just check wheather your Lookup is running fine independently or not, if its run fine and then  also your expression gives error then try to put your lookup expression in a textbox and use this text box in your original expression.

    I hope this will help.

    Thursday, December 11, 2014 5:53 AM
  • User-2112117666 posted

    Hi,

    Thanx for reply...Nishantg

    my Lookup function running well,.. but i am new in ssrs plz can u explain your answer which about textbox... plz

    Thursday, December 11, 2014 6:10 AM
  • User-2112117666 posted

     in fact i am using two IIF statement with "OR" operator in my single expression and both IIF have lookup functions... when i delete my one IIF statement then it work good but when i run both IIF together in single expression it is not working... i think now you are understanding my problem

    =IIF(Year(Fields!Date.Value) <= 2015 AND Month(Fields!End_Date.Value) <= 02 AND Lookup(Fields!Project.Value,Fields!Project.Value,Fields!company.Value, "ds_Projects")="ABC", "Available", "No")

    OR
    IIF(Lookup(fields!a.value, fields!a.value, fileds!bill.value, "ds_projects")="xyz", "available", "No")

    Friday, December 12, 2014 6:30 AM
  • User-830595639 posted

    Ok, so if both of your expression are running fine separately then try to do like this.

    1. take two different text box in your report. 

    2. Put both expression separately in both text boxes.

    3. Then write a final expression like below

    IIF(ReportItems!Textbox1.Value ="ABC" OR ReportItems!Textbox2.Value = "XYZ","Available", "No")

    Here Textbox1 and Textbox2 are the name of the text boxes.

    Hope this will help you.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 12, 2014 7:36 AM