web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

IIF Condition

(0) ShareShare
ReportReport
Posted on by 3,099

Hi

  I want if Balance is < 0 then it should show Balance Amount + 'Dr'. If > 0 then Balance Amount + 'Cr' in report textfield

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Amol Salvi Profile Picture
    18,698 on at

    You can write this code on onaftergetrecord trigger

    If balance >0 then

     Balanceamount :=format (balance)+'dr'

    Else

     Balanceamount:=format(balance)+'cr'

    Define balanceamount aa variable with datatype text

  • Verified answer
    Tina Menezes Profile Picture
    2,582 on at

    Hi,

    You can define a variable 'Result' with datatype 'Text' in C/AL globals. Now in OnAfterGetRecord trigger you can write the following code:

    IF Balance <0 THEN

    Result:=FORMAT(Balance)+' Dr'

    ELSE

    Result:=FORMAT(Balance)+' Cr';

    Use this text variable 'Result' in your report textfield.

  • mmv Profile Picture
    11,471 on at

    Hi,

    You may use the methods mentioned by Amol and Tina

  • Suggested answer
    Yogesh Kulkarni_ Profile Picture
    1,762 on at

    Yes, you may use the methods by Amol sir and Tina.

    Or else you can directly provide the Expression of the Textbox as:

    iif(Balance < 0,CStr(Balance)+"Dr",CStr(Balance)+"Cr")

     

    -Yogesh Kulkarni
    Please verify, if you find answer helpful.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans