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

Problem with formulas

Status
Not open for further replies.

Jyme

MIS
Apr 28, 2004
29
US

1.

I have a formula in Crystal Reports 9:

[blue]
if(isnull({RECORDED_SERVICE.SERVICE_STATUS_MONIKER})) then
{RECORDED_SERVICE.UNITS}
else
if ({RECORDED_SERVICE.SERVICE_STATUS_MONIKER}="FB07BA368454433A989B840BDCE7340F")
then
{RECORDED_SERVICE.UNITS}
else
0
[/blue]
However if the two conditions are false I never get the 0..why?
[red]
2.
[/red]
I have another formula that I want to go through a list of possible contact types, in order, and give me the number. If it gets to one that satisfies the criteria, I want it to give me that number and only that number..so i created a variable called checker. If checker is a 0 then evaluate the condition, if not dont. Heres what I have so far:
[blue]
NumberVar checker :=0 ;

if ({contact.type} ='0480BE5B1CD54E79B161B533C50AA742') then
{contact.number};
checker := 1;

if ({contact.type} ='D4A537D6890040C994AD1F32A9E10F66') and checker
<> 1 then
{contact.number};
checker := 1;

if ({contact.type} ='31C5F9B0FE31462488649C7FB095869B') and checker
<> 1 then
{contact.number};
checker := 1;


if ({contact.type} ='A42A3BEAC1BB4B9E889E596039ABB485') and checker
<> 1 then
{contact.number};
checker := 1;


if ({contact.type} ='F119D5D5D79244FBB33B7D0AFCF258E8') and checker
<> 1 then
{contact.number};
checker := 1;


if ({contact.type} ='4A712FB4C549440499E36538EF2F9E3D') and checker
<> 1 then
{contact.number};
checker := 1;

if checker = 0 then
"No Contact Number"
[/blue]

So it will go to each if statement, if the if statement is true then checker would be set to = 1 and the rest of the if statements below it (and above it for that matter) should be false thus only giving me one contact number..Its not producing a number now and I dont know why, any help is appreciated..thanks

-Jim [thumbsup2]
 
For your second formula, try this (I'm assuming that {contact.number} is a string):
Code:
StringVar checker :='' ;

if ({contact.type} ='0480BE5B1CD54E79B161B533C50AA742') then
checker := {contact.number};

if ({contact.type} ='D4A537D6890040C994AD1F32A9E10F66') and (checker <> '') then
checker := {contact.number};


if ({contact.type} ='31C5F9B0FE31462488649C7FB095869B') and (checker <> '') then
checker := {contact.number};


if ({contact.type} ='A42A3BEAC1BB4B9E889E596039ABB485') and (checker <> '') then
checker := {contact.number};

if ({contact.type} ='F119D5D5D79244FBB33B7D0AFCF258E8') and (checker <> '') then
checker := {contact.number};

if ({contact.type} ='4A712FB4C549440499E36538EF2F9E3D') and (checker <> '') then
checker := {contact.number};

if (checker = '') then
checker := "No Contact Number";

checker;
In order to be able to get data into the report when you're working with multiple statements and one or more variables, you have to be able to set the last line of your formula to the data you want to have displayed.

-D
 
I have your same problem on my formula:

If Not IsNull({Brokerage_Offer.ReducedAmount}) and ({Brokerage_Offer.ReducedAmount} > 0) then
{Brokerage_Offer.ExpireDate} else
If DateValue({Brokerage.ExtendDate2}) <> CurrentDate then
{Brokerage.ExtendDate2} else
If DateValue({Brokerage.ExtendDate1}) <> CurrentDate then
{Brokerage.ExtendDate1} else
{Brokerage.ExpirationDate}

It will not print Brokerage.ExpirationDate if all the other ifs fail.

I am also looking for an answer to this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top