Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Nested if then else Post Reply Post New Topic
Author Message
joeyg13
Newbie
Newbie
Avatar

Joined: 21 Dec 2010
Online Status: Offline
Posts: 15
Quote joeyg13 Replybullet Topic: Nested if then else
     Posted: 26 Jan 2011 at 4:38am
Working on a way to capture various data when a code is present for the data line.  But, keep getting syntax errors.  I know that it looks over-kill, but once I get this much, then I can add lots more data manipulation logic to the structure.

I define a Formula Field called key_data
and the Formula Workshop defines as follows:


whilePrintingRecords;
shared numberVar pat_HBA1C;
shared numberVar pat_date_HBA1C;
shared numberVar pat_LDL;
//See if a change of Patient ID; if so, clear the variables
if {OBS.PID} <> previous({OBS.PID}) then
  (
   pat_HBA1C := 0;
   pat_date_HBA1C := 0;
   pat_LDL :=0;
  )
else
//Check for the HBA1C obs code
  (
  if {OBS.HDID} = 28.00 then
    (
     pat_HBA1C := {OBS.OBSVALUE};
     pat_HBA1C_date_HBA1C := {OBS.OBSDATE};
    )
//Check for the LDL obs code
  if {OBS.HDID} = 30.00 then
    (
     pat_LDL := {OBS.OBSVALUE}
    )
   )
 
 

 
 



Edited by joeyg13 - 26 Jan 2011 at 4:57am
IP IP Logged
joeyg13
Newbie
Newbie
Avatar

Joined: 21 Dec 2010
Online Status: Offline
Posts: 15
Quote joeyg13 Replybullet Posted: 26 Jan 2011 at 5:36am
Found most of my errors thru trial & error.  Now dealing with text to number issues.

whilePrintingRecords;
shared numberVar pat_HBA1C;
shared numberVar pat_date_HBA1C;
shared numberVar pat_LDL;
//See if a change of Patient ID; if so, clear the variables
if {OBS.PID} <> previous({OBS.PID}) then
  (
   pat_HBA1C := 0;
   pat_date_HBA1C := 0;
   pat_LDL :=0;
  );
//Check for the HBA1C obs code
if {OBS.HDID} = 28.00 then
  (  
   pat_HBA1C := {OBS.OBSVALUE};
   pat_date_HBA1C := {OBS.OBSDATE};
  );
//Check for the LDL obs code
if {OBS.HDID} = 30.00 then
  (
   pat_LDL := {OBS.OBSVALUE};
  )

 
 

IP IP Logged
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