Skip to main content
Post a question

Notifications

Community site session details

Community site session details

Session Id : D63lP0oNE9DYgpYUdzGKkZ
Microsoft Dynamics CRM (Archived)

IIf Condition is not working in SSRS Report

Like (0) ShareShare
ReportReport
Posted on 6 Mar 2019 06:14:18 by 317

Dear All,

 I have created one Custom report for Account Entity and wrote an Expression for address1_line1 and address1_line2 Field, its not working(please refer below mentioned Expression). I have tried in Two different instances which are online D365 version, Since i am facing the issue from Yesterday., after deploying in CRM instance i m getting as #Error in that Column.

Expression :=iif(Fields!address1_line1.Value,Fields!address1_line1.Value,Fields!address1_line2.Value)

Please suggest me for the same.

Regards,

Krishna.

*This post is locked for comments

  • Suggested answer
    Krishna potdar Profile Picture
    317 on 27 Mar 2019 at 05:25:08
    RE: IIf Condition is not working in SSRS Report

    Dear All,

    we have wrote three Expression by using different Place holders that is resolved.

    Regards,

    Krishna

  • Krishna potdar Profile Picture
    317 on 27 Mar 2019 at 05:21:01
    RE: IIf Condition is not working in SSRS Report

    Hi preeti,

    Thanks for your reply!

    i tried using & also it didn't worked for me.

    Regards,

    Krishna

  • Krishna potdar Profile Picture
    317 on 27 Mar 2019 at 05:19:09
    RE: IIf Condition is not working in SSRS Report

    HI Samrando,

    Thanks for your reply!

    i tried the above mentioned expression it didn't worked for me.

    Regards,

    Krishna

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    7,755 on 14 Mar 2019 at 08:24:10
    RE: IIf Condition is not working in SSRS Report

    Hi Krishna,

    Please try below code:

    IIF(IsNothing(Fields!address1_line1.Value) AND IsNothing(Fields!address1_line2.Value),"",

    IIF(!IsNothing(Fields!address1_line1.Value) AND !IsNothing(Fields!address1_line2.Value), Fields!address1_line1.Value +","+ Fields!address1_line2.Value,

    IIF(IsNothing(Fields!address1_line1.Value) AND !IsNothing(Fields!address1_line2.Value ), Fields!address1_line2.Value,

    IIF(IsNothing(Fields!address1_line2.Value ) AND !IsNothing(Fields!address1_line1.Value), Fields!address1_line1.Value,""))))

  • Suggested answer
    Preeti Sharma Profile Picture
    2,678 on 14 Mar 2019 at 07:47:46
    RE: IIf Condition is not working in SSRS Report

    Hello Krishna,

    In your expression where you are trying to concatenate the string as below:

    iif((Fields!address1_line1.Value) AND (Fields!address1_line2.Value), Fields!address1_line1.Value +","+ Fields!address1_line2.Value

    Can you please try to concatenate using "&"  instead of "+" as follow:

    iif((Fields!address1_line1.Value) AND (Fields!address1_line2.Value), Fields!address1_line1.Value &","& Fields!address1_line2.Value

    Hope this helps:)

    Thanks

    Preeti Sharma

  • Krishna potdar Profile Picture
    317 on 13 Mar 2019 at 13:02:55
    RE: IIf Condition is not working in SSRS Report

    Hi Dynamics365 Rocker,

    Thanks for your reply!

    please go through the below mentioned Expression which i am trying to achieve and at the end its showing me the error in the report like this.#Error

    =iif(isnothing(Fields!address1_line1.Value) AND isnothing(Fields!address1_line2.Value),"",

    iif((Fields!address1_line1.Value) AND (Fields!address1_line2.Value), Fields!address1_line1.Value +","+ Fields!address1_line2.Value,

    iif(isnothing(Fields!address1_line1.Value) AND (Fields!address1_line2.Value ), Fields!address1_line2.Value,

    iif(isnothing(Fields!address1_line2.Value ) AND (Fields!address1_line1.Value), Fields!address1_line1.Value,""))))

    Please advice me for the same if i wrote anything wrong in above mentioned expression.

    Regards,

    Krishna.

  • Dynamics365 Rocker Profile Picture
    7,755 on 12 Mar 2019 at 16:03:10
    RE: IIf Condition is not working in SSRS Report

    First of all describe that what do you want to achieve by this condition.

    You must write your condition like this:

    =iif(Fields!address1_line1.Value!=null,Fields!address1_line1.Value,Fields!address1_line2.Value)

  • Suggested answer
    Samrando Profile Picture
    270 on 12 Mar 2019 at 14:34:50
    RE: IIf Condition is not working in SSRS Report

    Hi Krishna

    I just wrote this by head without testing but please check it out. I derived it from the options you have provided above. if 'and' logic operator doesn't work try 'Or' 

    =IIf(IsNothing(Fields!address1_line1.Value), Fields!address1_line2.Value,  

    IIF(IsNothing(Fields!address1_line2.Value),Fields!address1_line1.Value, 

    IFF(IsNothing(Fields!address1_line1.Value) and IsNothing(Fields!address1_line1.Value), "Null", Fields!address1_line1.Value & & Fields!address1_line1.Value))

  • Krishna potdar Profile Picture
    317 on 12 Mar 2019 at 06:42:24
    RE: IIf Condition is not working in SSRS Report

    HI Abby Kong,

    Thanks for your response !

    I will check with that and update you shortly.

    Regards,

    Krishna.

  • Abby Kong Profile Picture
    6 on 08 Mar 2019 at 11:38:41
    RE: IIf Condition is not working in SSRS Report

    Hi Krishna,

    Would suggest implementing this in Dynamics to reuse in multiple reports.

    ----------------------------------------------------------------------------------

    You only post the business logic and didn't post the code to check where is wrong?To implement the blow logic in report, try switch function, based on the different conditions, pick a value from line1, line 2, line1&", "&line2, null

    https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/switch-function

    1) if the address1_line1 doesn't have data and  address1_line2 has data, print address1_line2.

    2)if the address2_line2 doesn't have dataand   address1_line1 has data print address1_line1

    3) if address1_line1  and address1_line2 both having data print like this - address1_line1, adress1_line2

    4)if address1_line1 and address1_line 2 both are not having data than print as null

    Regards,

    Abby

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,829 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,757 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans