Print Page | Close Window

if, then, else formula

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20284
Printed Date: 28 Apr 2024 at 10:37pm


Topic: if, then, else formula
Posted By: sheriberi
Subject: if, then, else formula
Date Posted: 12 Dec 2013 at 9:06am
I have the most basic formula that isn't working.  Patients that have diabetes exist in the DIABETES table, and those that do not have it are not in the  DIABETES table.  I want to show all patients with a Y or N in that column indicating if they have diabetes.
 
if ({PATIENT.PAT_ID} = {DIABETES.PAT_ID})
then "Y"
else "N"
 
I am getting a Y for patients that exist in the DIABETES table, but am not getting the N for patients that don't.
 
The DIABETES table is left joined to the PATIENT table by PAT_ID
 
This should be working and its crazy that it isn't.
Any ideas?



Replies:
Posted By: kevlray
Date Posted: 12 Dec 2013 at 12:03pm
I would think you would want a left outer join to the DIABETES table then you would just need to say

if isnull({DIABETES.PAT_ID}) then "N" else "Y"

You may need to change the 'Exception for Nulls' to 'Default Values for Nulls' in the formula editor.



Print Page | Close Window