Ignore:
Timestamp:
Apr 9, 2010, 9:13:04 AM (15 years ago)
Author:
Kevin Toppenberg
Message:

Template formulas will calculate even if responses have characters, bug fixes

Location:
cprs/branches/tmg-cprs/CPRS-Chart/Templates
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cprs/branches/tmg-cprs/CPRS-Chart/Templates/fTemplateDialog.pas

    r729 r735  
    219219    frmTemplateDialog.HTMLAnswerOpenTag := '<I>'; //kt 12/28/09
    220220    //SL.Text := RemoveHTMLTags(SL.Text);  //elh
     221    HideFormulas(SL,frmTemplateDialog.Formulas); //kt added 3/26/10
    221222    AssignFieldIDs(SL,frmTemplateDialog.NameToObjID);   //kt  added NameToObjID param 3/26/10
    222     HideFormulas(SL,frmTemplateDialog.Formulas); //kt added 3/26/10
    223223    HideTxtObjects(SL,frmTemplateDialog.TxtObjects); //kt added 3/28/10
    224224    frmTemplateDialog.SL := SL;
     
    230230    frmTemplateDialog.FirstIndent := 99999;
    231231    repeat
     232    //messagedlg(Txt,mtInformation,mbOKCancel,0);
    232233      i := pos(ObjMarker, Txt);
    233234      if(i > 1) then begin
     
    280281          //kt -- end mod --
    281282          GetText(SL, TRUE);     {TRUE = Include embedded fields}
    282           {
    283           if uTemplates.bUsingHTMLMode then begin
    284              SL.Text := FormatHTMLTags(SL.Text);
    285           end else begin
    286              SL.Text := RemoveHTMLTags(SL.Text);
    287           end;
    288           }
    289283        end else begin
    290284          if (not PreviewMode) and (not frmTemplateDialog.Silent) and (not uInit.TimedOut) then begin
  • cprs/branches/tmg-cprs/CPRS-Chart/Templates/uTemplateFields.pas

    r729 r735  
    198198function StripEmbedded(iItems: string): string;
    199199function CloseCharPos(OpenChar, CloseChar : char; var Txt : string; StartingPos : integer=1) : integer; //kt added
     200function FormatFormula(test: string): string;  //elh  04/09/10
    200201
    201202type
     
    549550    //p2 := PosEx(FN_END_TAG,Txt,p1);
    550551    p2 := CloseCharPos(FN_BEGIN_TAG, FN_END_TAG, Txt, p1);
    551     SubStrB := MidStr(Txt,p2+1,999);
     552    SubStrB := MidStr(Txt,p2+1,99999);    //Changed from 999 to 99999. Some characters were getting lost including the dialog tags that trigger the dialog box   elh  04/08/10
    552553    FnStr := MidStr(Txt,p1, (p2-p1));
    553554    FnStr := AnsiReplaceText(FnStr,#9,'');
     
    647648    FldName := NameToObjID.Strings[i];
    648649    for j := 0 to i do begin
    649       if NameToObjID.Strings[i] = FldName then inc(CountofSimilar);
     650      if NameToObjID.Strings[j] = FldName then inc(CountofSimilar);     //Changed from i to j  elh  04/08/10
    650651    end;
    651652    CountOfSimStr := IntToStr(CountofSimilar);
     
    11231124          FnObjStr := FN_OBJ_TAG + FnObjStr + ']';
    11241125        end;
     1126        FnObjStr := FormatFormula(FnObjStr);  //Added to remove all characters from the formula  elh  4/9/10
    11251127        if (Pos(FN_OBJ_TAG,FnObjStr)>0) then begin
    11261128          EvalTIUObjects(FnObjStr);
     
    30213023end;
    30223024
     3025function FormatFormula(test: string): string;
     3026var
     3027   test2: string;
     3028   i: integer;
     3029begin
     3030   for i := 1 to length(test) do begin
     3031      if test[i] in ['0'..'9','+','-','*','/','(',')','^'] then begin
     3032         test2 := test2 + test[i];
     3033      end;
     3034   end;
     3035   Result := test2;
     3036end;
     3037
    30233038initialization
    30243039
Note: See TracChangeset for help on using the changeset viewer.