Question Status

Verified
jsshivalik asked a question on 12 Aug 2017 12:50 PM

Hi

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

Thanks

Reply
Verified Answer
Amol Salvi responded on 12 Aug 2017 1:21 PM

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

Reply
Verified Answer
Tina Menezes responded on 13 Aug 2017 11:00 AM

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.

Reply
Mahesh responded on 13 Aug 2017 9:56 PM

Hi,

You may use the methods mentioned by Amol and Tina

Reply
Suggested Answer
Yogesh Kulkarni responded on 14 Aug 2017 1:10 AM

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.

Reply
Verified Answer
Amol Salvi responded on 12 Aug 2017 1:21 PM

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

Reply
Verified Answer
Tina Menezes responded on 13 Aug 2017 11:00 AM

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.

Reply
Suggested Answer
Yogesh Kulkarni responded on 14 Aug 2017 1:10 AM

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.

Reply