Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If then statment in Crystal reports V10 1

Status
Not open for further replies.

Eddie920

Technical User
May 3, 2007
3
US
I am having a problem with the following formula:
if {@Sales tax}>0 then formula={STP_ProjectView.AmountBilled}-{@Sales tax} else formula={STP_ProjectView.AmountBilled}

The formuala is supposed to give me the price of a job less the sales tax if sales tax is part of the sales price.
The problem is the table that contains the sales tax does not contain all job numbers so when it looks for @Sales tax it finds nothing for those jobs so they are not included in my report. I need to know how to write the formula where it disregards the fact that the table has no value for sales tax for a job but still gives me a value. Hopefully this gives everyone enough information.
 
This should do it:

if {@Sales tax}>0 then ({STP_ProjectView.AmountBilled}-{@Sales tax}) else {STP_ProjectView.AmountBilled}



DataDog [pc2]
If God wanted us to count in Hexadecimal, then why did he only give us A fingers?
 
I tried it but Crystal gives me an error and asks for a statement in front of the quotations.
 
Datadog is using Crystal syntax and you were using Basic syntax. Using Crystal syntax (this is an option in the formula expert), try this formula:

if not isnull({@salestax}) and
{@salestax} > 0 then
{STP_ProjectView.AmountBilled}-{@Sales tax} else
{STP_ProjectView.AmountBilled}

-LB
 
Thank you very much, that works. I didn't know you had the option of using Crystal or Basic syntax when writing formulas.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top