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!

New Database Field Causing Problems in Formulas 1

Status
Not open for further replies.

johnny2bad

Programmer
Nov 6, 2001
18
US
I have a report that was written in CR 8.5 that I am trying to modify. I added several new fields to one of the database tables then verified the Database successfully. I can use one of the new fields in a formula and it reacts correctly if the condition is met. But if the condition is not met, it will not continue on through the formula.

Example:
{IPOXMIT.CPOFlag} is my new field

--Start Code Example--
Code:
[COLOR=blue]If[/color] {IPOXMIT.WareHouseCode} = "STR" [COLOR=blue]Then[/color] "STR" & {IPOXMIT.PONum} [COLOR=blue]Else[/color]
[COLOR=blue]If[/color] [COLOR=red]{IPOXMIT.CPOFlag}[/color] = "Y" [COLOR=blue]Then[/color] "CPO" & {IPOXMIT.PONum} [COLOR=blue]Else[/color]
{IPOXMIT.PONum}
--End Code Example--

Based on the above formula, if the {IPOXMIT.WareHouseCode} = "STR" Then the report displays "STRXXXXXXX"...No problems.

And if the new field {IPOXMIT.CPOFlag} = "Y" then it displays "CPOXXXXXXX"...Still no problems.

But if neither condition is met, then it should display just the field {IPOXMIT.PONum}....but it doesn't.

I can replace the new field in the second condition here with a field that existed before i started monkeying around with it and it steps through with no problems, so this leads me to believe that the problem has something to do with the new fields added.


Any Ideas?

JohnD


 
Perhaps the CPOFLAG has null and didn't used to.

Try:

If {IPOXMIT.WareHouseCode} = "STR" Then
"STR" & {IPOXMIT.PONum}
Else
If isnull({IPOXMIT.CPOFlag})
or
{IPOXMIT.CPOFlag} <> "Y"
Then
{IPOXMIT.PONum}
else
"CPO" & {IPOXMIT.PONum}

It seems like your formula should have worked, but try playing with null checking, it's the bane of CR...

-k
 
Thanks k, your statment worked perfectly!

CR is so retarded! Why would a null cause it to fail?

JohnD:Does 'Y' = Null?
CR:No.
JohnD:Well, then move on.
CR:No.
JohnD:Please.
CR:No.
JohnD:Pretty Please.
CR:H#!! NO! GO AWAY!!!

Thanks again k!

JohnD
(a.k.a Crystal Reports Hater)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top