Function

TfrmGraphs.SelectRef

Module

fGraphs

Last Modified

7/15/2014 3:26:36 PM

Comments

Check ref range for AGE and SEX variables in $S statement

Visibility

Private

Owner

TfrmGraphs

Declaration

function SelectRef(aRef: string): string;

Calls Hierarchy


TfrmGraphs.SelectRef
 └CheckRef

Called-By Hierarchy


                                           TfrmGraphs.SelectRef
                                          TfrmGraphs.RefUnits┘ 
                                       TfrmGraphs.TitleInfo┤   
                             TfrmGraphs.MakeSeparateItems┤ │   
                                TfrmGraphs.MakeSeparate┘ │ │   
                               TfrmGraphs.DisplayData┤   │ │   
                             TfrmFrame.ClearPatient┤ │   │ │   
                           TfrmFrame.SetupPatient┘ │ │   │ │   
                      UpdatePatientInfoForAlert┤   │ │   │ │   
                   TfrmFrame.mnuFileNextClick┘ │   │ │   │ │   
                 TfrmFrame.mnuFileOpenClick┤   │   │ │   │ │   
                     TfrmFrame.UMInitiate┤ │   │   │ │   │ │   
            TfrmFrame.mnuFileNextClick...┤ │   │   │ │   │ │   
            TfrmFrame.mnuFileRefreshClick┤ │   │   │ │   │ │   
            TfrmOrders.CheckOrderStatus┤ │ │   │   │ │   │ │   
        TfrmOrders.mnuActChgEvntClick┤ │ │ │   │   │ │   │ │   
           TfrmOrders.mnuActHoldClick┤ │ │ │   │   │ │   │ │   
         TfrmOrders.mnuActUnholdClick┤ │ │ │   │   │ │   │ │   
          TfrmOrders.mnuActRenewClick┤ │ │ │   │   │ │   │ │   
         TfrmOrders.mnuActChangeClick┤ │ │ │   │   │ │   │ │   
           TfrmOrders.mnuActCopyClick┘ │ │ │   │   │ │   │ │   
                 TfrmMeds.mnuActDCClick┤ │ │   │   │ │   │ │   
                TfrmMeds.CheckMedStatus┘ │ │   │   │ │   │ │   
             TfrmMeds.mnuActHoldClick┤   │ │   │   │ │   │ │   
            TfrmMeds.mnuActRenewClick┤   │ │   │   │ │   │ │   
           TfrmMeds.mnuActUnholdClick┤   │ │   │   │ │   │ │   
           TfrmMeds.mnuActChangeClick┤   │ │   │   │ │   │ │   
             TfrmMeds.mnuActCopyClick┤   │ │   │   │ │   │ │   
           TfrmMeds.mnuActRefillClick┘   │ │   │   │ │   │ │   
                       TfrmFrame.ViewInfo┘ │   │   │ │   │ │   
                    TfrmDCSumm.ViewInfo┤   │   │   │ │   │ │   
                  TfrmConsults.ViewInfo┤   │   │   │ │   │ │   
          TfrmFrame.pnlRemindersMouseUp┤   │   │   │ │   │ │   
           TfrmFrame.RemindersChanged┘ │   │   │   │ │   │ │   
               TfrmFrame.FormCreate┘   │   │   │   │ │   │ │   
                 TfrmFrame.pnlCIRNClick┤   │   │   │ │   │ │   
           TfrmFrame.pnlVistaWebClick┤ │   │   │   │ │   │ │   
                TfrmFrame.FormKeyDown┘ │   │   │   │ │   │ │   
              TfrmFrame.pnlPatientClick┤   │   │   │ │   │ │   
                TfrmFrame.pnlVisitClick┤   │   │   │ │   │ │   
          TfrmFrame.pnlPrimaryCareClick┤   │   │   │ │   │ │   
            TfrmFrame.pnlRemindersClick┤   │   │   │ │   │ │   
             TfrmFrame.pnlPostingsClick┤   │   │   │ │   │ │   
                 TfrmFrame.pnlFlagClick┤   │   │   │ │   │ │   
                   TfrmFrame.laMHVClick┤   │   │   │ │   │ │   
                  TfrmFrame.laVAA2Click┤   │   │   │ │   │ │   
                    TfrmOrders.ViewInfo┤   │   │   │ │   │ │   
                      TfrmMeds.ViewInfo┤   │   │   │ │   │ │   
                   TfrmSurgery.ViewInfo┤   │   │   │ │   │ │   
                     TfrmNotes.ViewInfo┤   │   │   │ │   │ │   
                  TfrmProblems.ViewInfo┘   │   │   │ │   │ │   
          TfrmFrame.mnuFileNotifRemoveClick┤   │   │ │   │ │   
                  TfrmFrame.NextButtonClick┘   │   │ │   │ │   
                TfrmFrame.SetUpNextButton┘     │   │ │   │ │   
          TfrmFrame.mnuFileOpenClick...┤       │   │ │   │ │   
                   TfrmFrame.FormResize┘       │   │ │   │ │   
                 TfrmFrame.ChangeFont┘         │   │ │   │ │   
         TfrmFrame.LoadSizesForUser┤           │   │ │   │ │   
    TfrmFrame.LoadUserPreferences┘ │           │   │ │   │ │   
           TfrmFrame.UMInitiate┘   │           │   │ │   │ │   
         TfrmFrame.mnuFontSizeClick┘           │   │ │   │ │   
                  TfrmFrame.mnuFileOpenClick...┤   │ │   │ │   
               TfrmFrame.AllowCCOWContextChange┤   │ │   │ │   
                TfrmFrame.mnuFileNextClick...┤ │   │ │   │ │   
                TfrmFrame.mnuFileOpenClick...┤ │   │ │   │ │   
       TfrmFrame.mnuFileResumeContextSetClick┘ │   │ │   │ │   
                    TfrmFrame.UpdateCCOWContext┤   │ │   │ │   
                TfrmFrame.mnuFileOpenClick...┤ │   │ │   │ │   
              TfrmFrame.ctxContextorCommitted┤ │   │ │   │ │   
               TfrmFrame.StartCCOWContextor┘ │ │   │ │   │ │   
                     TfrmFrame.FormCreate┘   │ │   │ │   │ │   
       TfrmFrame.mnuFileResumeContextGetClick┘ │   │ │   │ │   
         TfrmFrame.mnuFileResumeContextSetClick┘   │ │   │ │   
                            TfrmReports.ClearPtData┤ │   │ │   
                        TfrmFrame.ClearPatient...┘ │ │   │ │   
                                  TfrmReports.Graph┤ │   │ │   
                       TfrmReports.tvReportsClick┘ │ │   │ │   
                TfrmFrame.lstCIRNLocationsClick┤   │ │   │ │   
                          TfrmFrame.SetUpCIRN┘ │   │ │   │ │   
                  TfrmFrame.SetupPatient...┘   │   │ │   │ │   
                        TfrmReports.DisplayPage┤   │ │   │ │   
                       TfrmReports.LoadTreeView┤   │ │   │ │   
                      TfrmReports.DisplayPage┤ │   │ │   │ │   
         TfrmOptionsReportsDefault.btnOKClick┤ │   │ │   │ │   
      TfrmOptionsReportsDefault.btnResetClick┤ │   │ │   │ │   
       TfrmOptionsReportsCustom.btnApplyClick┘ │   │ │   │ │   
        TfrmOptionsReportsCustom.btnOKClick┘   │   │ │   │ │   
               TfrmReports.ProcessNotifications┤   │ │   │ │   
                      TfrmReports.DisplayPage┘ │   │ │   │ │   
                   TfrmReports.tvReportsKeyDown┤   │ │   │ │   
                TfrmReports.tvProceduresKeyDown┤   │ │   │ │   
                    TfrmReports.chkMaxFreqClick┤   │ │   │ │   
           TfrmOptionsReportsDefault.btnOKClick┤   │ │   │ │   
        TfrmOptionsReportsDefault.btnResetClick┤   │ │   │ │   
      TfrmOptionsReportsCustom.btnApplyClick...┘   │ │   │ │   
                        TfrmGraphs.chkItemsTopClick┤ │   │ │   
                     TfrmGraphs.chkItemsBottomClick┤ │   │ │   
                 TfrmGraphs.mnuPopGraphIsolateClick┤ │   │ │   
                      TfrmGraphs.cboDateRangeChange┤ │   │ │   
                    TfrmReports.lstDateRangeClick┤ │ │   │ │   
                         TfrmReports.GraphPanel┘ │ │ │   │ │   
                         TfrmReports.Graph...┤   │ │ │   │ │   
                TfrmReports.tvReportsClick...┘   │ │ │   │ │   
                            TfrmGraphs.Initialize┤ │ │   │ │   
                      TfrmFrame.ClearPatient...┤ │ │ │   │ │   
                TfrmFrame.mnuToolsGraphingClick┤ │ │ │   │ │   
                         TfrmLabs.grdLabClick┤ │ │ │ │   │ │   
                      TfrmLabs.tvReportsClick┤ │ │ │ │   │ │   
                       TfrmLabs.DisplayPage┤ │ │ │ │ │   │ │   
                      TfrmLabs.LoadTreeView┤ │ │ │ │ │   │ │   
                     TfrmLabs.DisplayPage┤ │ │ │ │ │ │   │ │   
TfrmOptionsReportsCustom.btnApplyClick...┘ │ │ │ │ │ │   │ │   
                TfrmLabs.cmdOtherTestsClick┤ │ │ │ │ │   │ │   
                   TfrmLabs.chkMaxFreqClick┤ │ │ │ │ │   │ │   
              TfrmLabs.ProcessNotifications┤ │ │ │ │ │   │ │   
                     TfrmLabs.DisplayPage┘ │ │ │ │ │ │   │ │   
                                  ..(rec)..┤ │ │ │ │ │   │ │   
                  TfrmLabs.tvReportsKeyDown┤ │ │ │ │ │   │ │   
         TfrmFrame.lstCIRNLocationsClick...┘ │ │ │ │ │   │ │   
                                    ..(rec)..┘ │ │ │ │   │ │   
                     TfrmReports.ClearPtData...┤ │ │ │   │ │   
                           TfrmReports.Graph...┘ │ │ │   │ │   
                              TfrmGraphs.FormShow┤ │ │   │ │   
                TfrmGraphs.btnChangeSettingsClick┤ │ │   │ │   
                 TfrmReports.btnChangeViewClick┘ │ │ │   │ │   
                     TfrmGraphs.CheckExpandedLabs┤ │ │   │ │   
                          TfrmGraphs.ItemsClick┘ │ │ │   │ │   
                    TfrmGraphs.DisplayData...┤   │ │ │   │ │   
               TfrmGraphs.lvwItemsBottomClick┤   │ │ │   │ │   
                   TfrmGraphs.Initialize...┤ │   │ │ │   │ │   
                    TfrmGraphs.CheckContext┤ │   │ │ │   │ │   
                      TfrmGraphs.FormShow┘ │ │   │ │ │   │ │   
               TfrmGraphs.chkDualViewsClick┤ │   │ │ │   │ │   
                 TfrmGraphs.Initialize...┤ │ │   │ │ │   │ │   
                      TfrmGraphs.FormShow┤ │ │   │ │ │   │ │   
                                   Layout┤ │ │   │ │ │   │ │   
                     TfrmGraphs.GetSize┘ │ │ │   │ │ │   │ │   
                  TfrmGraphs.FormShow┘   │ │ │   │ │ │   │ │   
     TfrmGraphs.mnuPopGraphDualViewsClick┤ │ │   │ │ │   │ │   
                TfrmGraphs.ViewSelections┘ │ │   │ │ │   │ │   
          TfrmReports.tvReportsClick...┤   │ │   │ │ │   │ │   
     TfrmGraphs.btnGraphSelectionsClick┘   │ │   │ │ │   │ │   
  TfrmReports.btnGraphSelectionsClick┘     │ │   │ │ │   │ │   
                     TfrmGraphs.GraphSwitch┤ │   │ │ │   │ │   
                     TfrmGraphs.GraphSwap┘ │ │   │ │ │   │ │   
        TfrmGraphs.mnuPopGraphSwapClick┘   │ │   │ │ │   │ │   
                      TfrmGraphs.SplitClick┤ │   │ │ │   │ │   
         TfrmGraphs.mnuPopGraphSplitClick┘ │ │   │ │ │   │ │   
           TfrmGraphs.mnuPopGraphClearClick┤ │   │ │ │   │ │   
                      TfrmGraphs.AutoSelect┤ │   │ │ │   │ │   
                   TfrmGraphs.ViewsChange┘ │ │   │ │ │   │ │   
           TfrmGraphs.lstViewsTopChange┤   │ │   │ │ │   │ │   
             TfrmGraphs.Initialize...┤ │   │ │   │ │ │   │ │   
            TfrmGraphs.GraphSwitch...┤ │   │ │   │ │ │   │ │   
     TfrmGraphs.cboDateRangeChange...┤ │   │ │   │ │ │   │ │   
         TfrmGraphs.ViewSelections...┘ │   │ │   │ │ │   │ │   
        TfrmGraphs.lstViewsBottomChange┘   │ │   │ │ │   │ │   
             TfrmGraphs.Initialize...┤     │ │   │ │ │   │ │   
            TfrmGraphs.GraphSwitch...┤     │ │   │ │ │   │ │   
     TfrmGraphs.cboDateRangeChange...┤     │ │   │ │ │   │ │   
         TfrmGraphs.ViewSelections...┘     │ │   │ │ │   │ │   
            TfrmGraphs.lvwItemsBottomChange┘ │   │ │ │   │ │   
                  TfrmGraphs.lvwItemsTopClick┘   │ │ │   │ │   
                   TfrmGraphs.Initialize...┤     │ │ │   │ │   
                        TfrmGraphs.FormShow┤     │ │ │   │ │   
            TfrmGraphs.chkDualViewsClick...┤     │ │ │   │ │   
                  TfrmGraphs.GraphSwitch...┤     │ │ │   │ │   
                   TfrmGraphs.SplitClick...┤     │ │ │   │ │   
           TfrmGraphs.mnuPopGraphClearClick┤     │ │ │   │ │   
                   TfrmGraphs.AutoSelect...┤     │ │ │   │ │   
           TfrmGraphs.mnuPopGraphResetClick┤     │ │ │   │ │   
                      TfrmGraphs.FormShow┤ │     │ │ │   │ │   
    TfrmGraphs.mnuPopGraphHorizontalClick┤ │     │ │ │   │ │   
      TfrmGraphs.mnuPopGraphVerticalClick┤ │     │ │ │   │ │   
        TfrmGraphs.mnuPopGraphRemoveClick┤ │     │ │ │   │ │   
      TfrmGraphs.mnuPopGraphZoomBackClick┘ │     │ │ │   │ │   
               TfrmGraphs.lvwItemsTopChange┘     │ │ │   │ │   
                        TfrmGraphs.ViewsChange...┤ │ │   │ │   
             TfrmGraphs.mnuPopGraphMergeLabsClick┘ │ │   │ │   
                           TfrmGraphs.ItemsClick...┤ │   │ │   
                          TfrmGraphs.ViewsChange...┤ │   │ │   
                  TfrmGraphs.mnuPopGraphRemoveClick┘ │   │ │   
                         TfrmGraphs.MakeTogetherMaybe┘   │ │   
                          TfrmGraphs.DisplayData...┘     │ │   
                         TfrmGraphs.MakeTogetherOnlyLines┤ │   
                                TfrmGraphs.MakeTogether┘ │ │   
                      TfrmGraphs.MakeTogetherMaybe...┘   │ │   
                          TfrmGraphs.MakeTogetherAnyLines┘ │   
                             TfrmGraphs.MakeTogether...┘   │   
                                          TfrmGraphs.SetRef┤   
                                      TfrmGraphs.TempData┤ │   
                                 TfrmGraphs.AllTypeDate┘ │ │   
                              TfrmGraphs.SeriesClicks┤   │ │   
                    TfrmGraphs.chartBaseClickSeries┘ │   │ │   
                             TfrmGraphs.MakeChart┘   │   │ │   
                TfrmGraphs.MakeSeparateItems...┤     │   │ │   
                     TfrmGraphs.MakeTogether...┘     │   │ │   
                               TfrmGraphs.LabelClicks┤   │ │   
                             TfrmGraphs.MouseClicks┘ │   │ │   
                    TfrmGraphs.chartBaseMouseDown┘   │   │ │   
                    TfrmGraphs.chkItemsTopClick┤     │   │ │   
                 TfrmGraphs.chkItemsBottomClick┤     │   │ │   
                        TfrmGraphs.MakeChart...┘     │   │ │   
                   TfrmGraphs.mnuPopGraphDetailsClick┘   │ │   
                            TfrmGraphs.MakeChart...┤     │ │   
                          TfrmGraphs.LabelClicks...┘     │ │   
                                     TfrmGraphs.OtherInfo┘ │   
                                   TfrmGraphs.ValueText┘   │   
                           TfrmGraphs.SeriesClicks...┤     │   
                             TfrmGraphs.ItemDateRange┤     │   
                              TfrmGraphs.AllDetails┤ │     │   
            TfrmGraphs.mnuPopGraphDetailsClick...┘ │ │     │   
                    TfrmGraphs.chartBaseClickLegend┘ │     │   
                          TfrmGraphs.MakeChart...┘   │     │   
                            TfrmGraphs.LabelClicks...┤     │   
                TfrmGraphs.mnuPopGraphDetailsClick...┤     │   
                         TfrmGraphs.timHintPauseTimer┘     │   
                                    TfrmGraphs.SetRefNonNum┤   
                                    TfrmGraphs.NonNumText┘ │   
                                TfrmGraphs.ValueText...┘   │   
                                    TfrmGraphs.SpecRefCheck┘   
                                       TfrmGraphs.LabData┘     
                                TfrmGraphs.SaveTestData┤       
                                   TfrmGraphs.FastLab┘ │       
                                  TfrmGraphs.Switch┘   │       
                           TfrmGraphs.InitialData┤     │       
                       TfrmGraphs.Initialize...┘ │     │       
                TfrmGraphs.lvwItemsBottomClick...┤     │       
                   TfrmGraphs.lvwItemsTopClick...┘     │       
                              TfrmGraphs.CheckToAddData┘       
                            TfrmGraphs.AllTypeDate...┤         
                             TfrmGraphs.ItemsClick...┘         

Calls

Name Declaration Comments
CheckRef procedure CheckRef(selection: string; var value: string; var ok: boolean); -

Called-By

Name Declaration Comments
TfrmGraphs.RefUnits procedure RefUnits(aItem, aSpec: string; var low, high, units: string); -


Source

5898  function TfrmGraphs.SelectRef(aRef: string): string;
5899  // check ref range for AGE and SEX variables in $S statement
5900  
5901    procedure CheckRef(selection: string; var value: string; var ok: boolean);
5902    var
5903      age: integer;
5904      part1, part2, part3: string;
5905    begin
5906      value := '';
5907      ok := false;
5908      if pos('$S', selection) > 0 then exit;
5909      if pos(':', selection) = 0 then exit;
5910      part1 := Piece(selection, ':', 1);
5911      part2 := Piece(selection, ':', 2);
5912      part3 := Piece(selection, ':', 3);
5913      if length(part1) = 0 then exit;
5914      if length(part2) = 0 then exit;
5915      if length(part3) <> 0 then exit;
5916      ok := true;
5917      value := part2;
5918      if part1 = '1' then exit;
5919      if copy(part1, 1, 4) = 'SEX=' then
5920      begin
5921        if (part1 = 'SEX="M"') and (Patient.Sex = 'M') then exit;
5922        if (part1 = 'SEX="F"') and (Patient.Sex = 'F') then exit; //?? check for '= '> '<    ??
5923        value := '';
5924      end
5925      else if copy(part1, 1, 3) = 'AGE' then
5926      begin
5927        part3 := copy(part1, 5, length(part1));
5928        age := strtointdef(part3, BIG_NUMBER);
5929        if age <> BIG_NUMBER then
5930        begin
5931          part3 := copy(part1, 1, 4);
5932          if (part3 = 'AGE>') and (Patient.Age > age) then exit;
5933          if (part3 = 'AGE<') and (Patient.Age < age) then exit;
5934          if (part3 = 'AGE=') and (Patient.Age = age) then exit;
5935        end;
5936        value := '';
5937      end
5938      else
5939        value:= '';
5940    end;
5941  
5942  var
5943    ok: boolean;
5944    i: integer;
5945    selection, selections: string;
5946  begin
5947    Result := '';
5948    if copy(aRef, length(aRef), 1) = ')' then
5949    begin
5950      selections := copy(aRef, 4, length(aRef) - 4);
5951      for i := 1 to BIG_NUMBER do
5952      begin
5953        selection := Piece(selections, ',', i);
5954        if selection = '' then break;
5955        ok := true;
5956        CheckRef(selection, Result, ok);
5957        if not ok then break;
5958        if length(Result) > 0 then break;
5959      end;
5960    end;
5961  end;