c# - Add and subtract simultaneously in one formula -
i have 3 columns in details section:
- s.no
- balance
- 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
Post a Comment