c# - Add and subtract simultaneously in one formula -


i have 3 columns in details section:

  1. s.no
  2. balance
  3. type

i want formula field total subtract value if type debit , add value when credit. logic in c++. how can rewrite in crystal syntax?

if(type=="credit")         total = total+balance     else if((type=="credit")        total = total-balance;    

you can try crystal report formula

if {type} = "credit" {total} := {total} + {balance} else if {type} = "debit" {total} := {total} - {balance} 

alternately can write case statement in sql query updated_total

select type, total,balance.....,      case          when type ="credit" (total + balance)          when type ="debit"   (total - balance)      end  updated_total  datatable ;  

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -