Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: if, then, else formula Post Reply Post New Topic
Author Message
sheriberi
Newbie
Newbie


Joined: 14 Feb 2013
Online Status: Offline
Posts: 6
Quote sheriberi Replybullet Topic: if, then, else formula
    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?
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet 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.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.020 seconds.