Trying to set one value from another in crystal reports

时间:2015-06-26 09:59:57

标签: crystal-reports

Hi everyone I have a problem I can't seem to get around, I am new to crystal so if I have missed something then please point it out. I am trying to achieve this. If a set of conditions are met then print a value if other conditions are met print a different value or else print main header. Below is what I have so far,

My problem is I can't seem to set the string to be correct.

WhilePrintingRecords;
  booleanVar bPrintedRAD;
  booleanVar bPrintedGCS;
  booleanVar bPrintedHEAD;
  booleanVar bPrintedTHROM;
  booleanVar bPrintedWAR;
  booleanVar bPrintedPAP;
  booleanVar bPrintedSYM;

  if {IS_DHFT_Aide_Memoir.CodeNum} = 5 then
    {IS_DHFT_Aide_Memoir.OrderItemName};

   shared stringVar OrderItemNameQ:= {IS_DHFT_Aide_Memoir.OrderItemName}; 



  If OrderItemNameQ = "CT Brain" 
   then

  if {CV3OrderUserData.UserDataCode} = "RAD Clinical Pathways"  
    //and {CV3OrderUserData.Value} = "Stroke"
    and instr ({CV3OrderUserData.Value},"Stroke")>0
    then bPrintedRAD := true;


  if {CV3OrderUserData.UserDataCode} = "CTBrain2gcs"
    and {CV3OrderUserData.Value} = "1" then bPrintedGCS := true;

 if {CV3OrderUserData.UserDataCode} = "ctbrain2headache"
   and {CV3OrderUserData.Value} = "1" then bPrintedHEAD := true;

if {CV3OrderUserData.UserDataCode} = "ctbrain2strokethrom"
  and {CV3OrderUserData.Value} = "1" then bPrintedTHROM := true;

if {CV3OrderUserData.UserDataCode} = "ctbrain2warfarin"
  and {CV3OrderUserData.Value} = "1" then bPrintedWAR := true;

if {CV3OrderUserData.UserDataCode} = "CTbrainpapillo"
  and {CV3OrderUserData.Value} = "1" then bPrintedPAP := true;

if {CV3OrderUserData.UserDataCode} = "ctbrainprogsym"
  and {CV3OrderUserData.Value} = "1" then bPrintedSYM := true;


if bPrintedRAD = true and (bPrintedGCS = true or bPrintedHEAD = true or   bPrintedTHROM = true or 
  bPrintedWAR = true or bPrintedPAP = true or bPrintedSYM = true)
   then OrderItemNameQ := "STROKE ONE HOUR"
 else 
 if bPrintedRAD = true and (bPrintedGCS = false and bPrintedHEAD = false and   bPrintedTHROM = false and
 bPrintedWAR = false and bPrintedPAP = false and bPrintedSYM = false)
   then OrderItemNameQ := "STROKE 24 HOURS"

1 个答案:

答案 0 :(得分:0)

我认为你的公式是正确的,但没有正确关闭块。试试这个:

WhilePrintingRecords;
  booleanVar bPrintedRAD;
  booleanVar bPrintedGCS;
  booleanVar bPrintedHEAD;
  booleanVar bPrintedTHROM;
  booleanVar bPrintedWAR;
  booleanVar bPrintedPAP;
  booleanVar bPrintedSYM;
shared stringVar OrderItemNameQ;

  if {IS_DHFT_Aide_Memoir.CodeNum} = 5 then
       OrderItemNameQ:= {IS_DHFT_Aide_Memoir.OrderItemName}; 



  If OrderItemNameQ = "CT Brain" 
   then
(
  if {CV3OrderUserData.UserDataCode} = "RAD Clinical Pathways"  
    //and {CV3OrderUserData.Value} = "Stroke"
    and instr ({CV3OrderUserData.Value},"Stroke")>0
    then bPrintedRAD := true;


  if {CV3OrderUserData.UserDataCode} = "CTBrain2gcs"
    and {CV3OrderUserData.Value} = "1" then bPrintedGCS := true;

 if {CV3OrderUserData.UserDataCode} = "ctbrain2headache"
   and {CV3OrderUserData.Value} = "1" then bPrintedHEAD := true;

if {CV3OrderUserData.UserDataCode} = "ctbrain2strokethrom"
  and {CV3OrderUserData.Value} = "1" then bPrintedTHROM := true;

if {CV3OrderUserData.UserDataCode} = "ctbrain2warfarin"
  and {CV3OrderUserData.Value} = "1" then bPrintedWAR := true;

if {CV3OrderUserData.UserDataCode} = "CTbrainpapillo"
  and {CV3OrderUserData.Value} = "1" then bPrintedPAP := true;

if {CV3OrderUserData.UserDataCode} = "ctbrainprogsym"
  and {CV3OrderUserData.Value} = "1" then bPrintedSYM := true;
)

if bPrintedRAD = true and (bPrintedGCS = true or bPrintedHEAD = true or   bPrintedTHROM = true or 
  bPrintedWAR = true or bPrintedPAP = true or bPrintedSYM = true)
   then OrderItemNameQ := "STROKE ONE HOUR"
 else 
 if bPrintedRAD = true and (bPrintedGCS = false and bPrintedHEAD = false and   bPrintedTHROM = false and
 bPrintedWAR = false and bPrintedPAP = false and bPrintedSYM = false)
   then OrderItemNameQ := "STROKE 24 HOURS";
OrderItemNameQ;