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

No Else

Status
Not open for further replies.

TEM3

Technical User
Dec 6, 2004
324
US
Using Crystal Reports 8.5:

I am doing something basically wrong in the following formula.....

if len(trim({CONTAINER.Container Description})) > 0 then
MyValues := MyValues & (trim({LABITEM.Lab Item Number}) & "(" & trim({CONTAINER.Container Description}) & ")" & ", ")
else
MyValues := MyValues & (trim({LABITEM.Lab Item Number}) & ", ");

My "else" statement does not execute, which it should if there is no container. For items not in a container I get nothing printed (those in a container print fine). If I comment out all but the last line, items not in a container print fine.

Help please!

 
It may be that you have "null" values in the field, which can cause problems like this. I would try something like this:
Code:
if (isnull({CONTAINER.Container Description})) or ({CONTAINER.Container Description} = '')) then
    MyValues := MyValues & (trim({LABITEM.Lab Item Number}) & ", ");
else
    MyValues := MyValues & (trim({LABITEM.Lab Item Number}) & "(" & trim({CONTAINER.Container Description}) & ")" & ", ")

-Dell





A computer only does what you actually told it to do - not what you thought you told it to do.
 
Try

stringVar MyValues;

MyValues := MyValues & (trim({LABITEM.Lab Item Number}) & ", ");

if len(trim({CONTAINER.Container Description})) > 0 then
MyValues := MyValues & (trim({LABITEM.Lab Item Number}) & "(" & trim({CONTAINER.Container Description}) & ")" & ", ");


MyValues

Mo
 
Sorry a little confusion here

stringVar MyValues;

MyValues := (trim({LABITEM.Lab Item Number}) & ", ");

if len(trim({CONTAINER.Container Description})) > 0 then
MyValues := (trim({LABITEM.Lab Item Number}) & "(" & trim({CONTAINER.Container Description}) & ")" & ", ");


MyValues

Mo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top