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

Mulitple IF statements in a formula

Status
Not open for further replies.

Maggied

Technical User
Jun 23, 2011
66
CA
Hi,
I came across this a long time ago and I can't remember what I did for this to work. Basically in the below formula only the first line works. When the {APTCP.TRXTYPE}) = 51 it will display Payment but when its the second it displays nothing.
I can't remember what I am doing wrong. Thanks :)

if {APTCP.TRXTYPE}) = 51 then "Payment"
else
if {APTCP.TRXTYPE} = 57 then "PrePayment"
Else
"Misc Payment
 
The code looks pretty correct (except for mismatched parans on the first line, which should give you an error).
 
yah that extra ) isn't in my formula sorry. But it will work only on the first if statement
 
YOu might want to add a null check at the beginning of the formula:

If isnull({table.field}) then
"" else
If ...

If that doesn't help, then please explain how you are using this formula and in what report section you are placing it.

-LB
 
Hi,
I was able to get the first two working. It had to do with my linking but now the third one will display the second ones result. I think I know the issue why but is there another formula to do it. If the record doesn't exist in the table aptcp I want it to return a value of MISC PAYMENT. What would be the formula?
 
If isnull({aptcp.field}) then
"Misc Payment" else
If (etc.)

The null check must be first.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top