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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.