PDA

Click to See Complete Forum and Search --> : [RESOLVED] Help in creating a formula


aldrean
Oct 25th, 2006, 08:11 PM
I am on creating an Accounts Receivable report with Crystal Reports wherein I am using a Select Query coming from my Access database and vb.net 2005 as my front end application.Now, on the query there were fields PatientName and Company.Basically, a Patient would have a Company that would shoulder his/her charges, but on some occasions there was none so the charges would be named to themselves.Using this scenario, I made my report grouped by Company's name in ascending order and make a formula field named @Patient with the code goes like this:
'Crystal Report Code
if {AccountReceivable.Company}="" then {AccountReceivable.PatientName} else {AccountReceivable.Company}

My logic here is that when a Patient does not have a Company, then his/her name would be displayed on the report where this formula was situated.Seems that it is not behaving the way it should be.Am I missing somthing here guys?Hope you figure it out for me.Should you need further infos or an attachments perhaps, feel free to ask...Thanks.

shakti5385
Oct 25th, 2006, 09:58 PM
The formula make by you is working properly then where you are getting the problem.Is it not working properly.
If your formula not working properly then pass a sql query that select those patient they have a company in this way there is no need of formula here.
Because you sorted the data directly with the query. :wave:

aldrean
Oct 25th, 2006, 10:47 PM
I finally find to make this work.I manage to check if the field is null first.Here's my revised code:'CrystalReport Code
if isnull({@Company}) then {AccountReceivable.Name} else {AccountReceivable.Company} where @Company is another formula with code that goes like this:'CrystalReport Code
if {AccountReceivable.Company}<>"" then {AccountReceivable.Company} else {AccountReceivable.Name}

shakti5385
Oct 26th, 2006, 01:14 AM
so did you get your solution