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

Why Why Why not working???????

Status
Not open for further replies.

jcoleman

MIS
Dec 24, 2002
87
CA
Can anyone tell me why the heck this is giving me a blank result?
Sorry it's so messy but I've tried so many different combinations.
It also started out a lot shorter.

local numbervar tender;
local stringvar ttype;

tender:=0;
if {Invoice header.$Meth payment 1}>0 then tender:=tender+1;
if {Invoice header.$Meth payment 2}>0 then tender:=tender+2;
...
if {Invoice header.$Meth payment 10}>0 then tender:=tender+10;
if {Invoice header.$Meth payment 11}>0 then tender:=tender+11;

if tender=1 then ttype:="Cash"
else if tender=2 then ttype:="Cheque"
else if tender=3 then ttype:="Visa"
...
else if tender=10 then ttype:="Charge"
else ttype:="Other";

ttype
 
Not sure but try this:
Code:
 if {Invoice header.$Meth payment 1}>0 then "Cash"
else if {Invoice header.$Meth payment 2}>0 then "Cheque"
else if {Invoice header.$Meth payment 10}>0 then "Visa"
else if {Invoice header.$Meth payment 11}>0 then "Charge"
else "other"

That is if the data fields are strings.
If they are number data fields use
Code:
 totext
.

Phillipg
 
Can any of the fields :

{Invoice header.$Meth payment 1}
{Invoice header.$Meth payment 2}
{Invoice header.$Meth payment 10}
{Invoice header.$Meth payment 11}

Have a NULL value?

Reebo
UK
 
As Reebo99 says, you need to check for nulls, which are 'show-stoppers', causing Crystal to stop without telling you it's done this.
Try something like
if not isnull ({Invoice header.$Meth payment 1})
and {Invoice header.$Meth payment 1}>0
then tender:=tender+1
etc.

Or do a formula field for each, e.g. Method1
if isnull ({Invoice header.$Meth payment 1})
then 0
else {Invoice header.$Meth payment 1}
You can then do your tests on Method1 etc.

Madawc Williams
East Anglia, Great Britain
 
Reebo,

Yes, most of them will be null, I'll have to try Madawc formula next.

Phillipg, I tried that one without any success. But thanks.

J

 
Madawc,

Thanks, that worked great.

You English guys are pretty smart.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top