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!

Empty string problem

Status
Not open for further replies.

Arde

Technical User
Aug 25, 2008
15
FI
Hi

I am using database where in the comments cell there is a string value Maintenanceorder z, if the order is maintenance and empty or random text if the order is Stock order.

In the report I need to categorize the orders by letter:
M=Maintenance order
S=Stock order

But when the comments cell is empty Crystal skips the record and don't print anything on that line.

I have tried the following:
If Left ({So_Order.Comments_2},11 )="Maintenance" Then
"M"
Else
"S"

If comments cell has any value the example works. But when empty Crystal skips the line and leave it empty.

Thanks
 
Try:

if isnull({So_Order.Comments_2}) or
trim({So_Order.Comments_2}) = "" or
trim({So_Order.Comments_2}) <> "Maintenance" then
"S" else
"M"

If field can be null, the null check must be first in the formula.

-LB
 
It works if the cell only reads Maintenance, but in the end there is number of the order i.e. Maintenance 100, Maintenance 101, ...
 
Modify Lbass' formula to:

if isnull({So_Order.Comments_2}) or
trim({So_Order.Comments_2}) = "" or
not(trim({So_Order.Comments_2}) startswith "Maintenance") then
"S" else
"M"


 
Or if Maintenance can be anywhere in the string or in mixed case, use:

if isnull({So_Order.Comments_2}) or
trim({So_Order.Comments_2}) = "" or
not(ucase({So_Order.Comments_2})like "*MAINTENANCE*") then
"S" else
"M"

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top