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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If then else question

Status
Not open for further replies.

jlr123

Technical User
Feb 24, 2014
117
US
Below is my formula but it is not working. Please assist with correct formula or let me know how to attain this in my report: 1. I want the Item Code if it is "/Delivery" and the Extension Amt - I don't want the item code nor the extension amount if the item code is not "/DELIVERY"

I do want all invoices to show up though and it is a field in my report.(which is [AR_invoiceHeaderHistory.Invoice])

if {AR_InvoiceHistoryDetail.ItemCode}<> "/DELIVERY"
then {AR_InvoiceHistoryDetail.ItemCode}="" and {AR_InvoiceHistoryDetail.ExtensionAmt}= 0 else if {AR_InvoiceHistoryDetail.ItemCode}= "/DELIVERY" then {AR_InvoiceHistoryDetail.ItemCode}= {AR_InvoiceHistoryDetail.ItemCode} and {AR_InvoiceHistoryDetail.ExtensionAmt}= {AR_InvoiceHistoryDetail.ExtensionAmt}

Thanks for your assistance.
 
Are you trying to assign a field a value? That is what it appears you are doing in the if statement and if so, it is not possible. In a formula you return a value. Thus in a If statement it would be in the form of If {some condition} then value1 else value2. Of course you can use nested if's If {some condition} then value1 else if {another condition} then value2 else value3.
 
You can use conditional formulas like this to replace each field:

//{@codefield}:
If {code}="/DELIVERY" then {code}

//{@amt}:
If {code}="/DELIVERY" then {amt}

If you need to insert any counts on either field, I would add a default value of {@null}. Create {@null} by opening a new formula and saving it without entering anything. Then change your formulas like this:

If {code}="/DELIVERY" then {code} else
{@null}

For the amount formula {@null} should be converted to a number by using:

Else tonumber({@null})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top