Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Crystal Reports 11 - if-then syntax question SQL Server 2005

Posted on 2011-02-23
2
Medium Priority
?
526 Views
Last Modified: 2012-05-11
Hello experts,

In a formula field, I have t he below syntax:

If {@RefType} = 'P' then {@Guarantor Name} else
If {@RefType} = 'I' and left({transactions.tracking_desc_40},1) = 'D' then 'DMERC Region B' else
If {@RefType} = 'I' and (left({transactions.tracking_desc_40},1) <> 'D' or {transactions.tracking_desc_40} = '' or isNull({transactions.tracking_desc_40})) then {payer_mstr.payer_name} else
''

This seems to function accurately when {transactions.tracking_desc_40}  starts with 'D', but when it's blank or null, it doesnt print payer_mstr.payer_name column, and we have verified that there is indeed a value in the payer_mstr.payer_name column as we have unhid it directly on the report.

Is there a problem with the way we have structured the nested if statements?

Thanks!
0
Comment
Question by:robthomas09
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 34965863
You have to test the NULL condition first.  Any test on  a NULL value except IsNull terminates the formula with undefined result.  Try it this way

If {@RefType} = 'P' then
     {@Guarantor Name}
else If {@RefType} = 'I' and ( isNull({transactions.tracking_desc_40}) or
                                                       {transactions.tracking_desc_40} = '' or
                                                  left({transactions.tracking_desc_40},1) <> 'D') then
    {payer_mstr.payer_name}
else If {@RefType} = 'I' and left({transactions.tracking_desc_40},1) = 'D' then
   'DMERC Region B'
else
   ''

mlmcc
0
 

Author Closing Comment

by:robthomas09
ID: 34966477
Thanks!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question