title: Pascal Script Fast Reports
body: <p>EDIT:</p>
  
  <p>Im having to edit some old Pascal Script in Fast Reports and are having a tough time returning only distinct records. Any help would be appreciated.</p>
  
  <p>So Basically, I am calling a stored proc to return data in a table. In one of these columns there sometimes are a 1 letter code (A,B,C) that defines which rtf file to go fetch for the report.</p>
  
  <p>Currently It does go fetch all of the rtf files for the respective codes, but sometimes the code is repeated (A,A) and in that case I need it to return only the DISTINCT rtf files. So If A was pulled allready, Dont Pull again and carry on looking for other codes in that Column</p>
  
  <p>My Code:
  NOTE: In Memo93 I am just inserting (table."Class")</p>
  
  <pre><code>    procedure GroupHeader17OnBeforePrint(Sender: TfrxComponent );
  var
         CarGroup: String     ;
         CarGroupLoop: String;  
  begin  
                         CarGroup := Memo93.Value;
                         if not(CarGroup = CarGroupLoop) then
                         begin
                                 try
                                         GroupHeader17.Visible := TRUE;
                                         rich23.richedit.lines.LoadFromFile('example\'+ trim(Get('@QteLanguage'))+ '\'+ trim(Get('@QteLanguage'))+'_Group_'+ trim(&lt;Table."class"&gt;)+ '.rtf');
  
                                 except
                                         GroupHeader17.Visible := FALSE;
  
                                 end;
                         end
                         else
                         begin
                                 GroupHeader17.Visible := False;
                         end;
  
                         CarGroupLoop := &lt;table."Class"&gt;;
  
  end;
  </code></pre>
  
  <p>This Seem to have done the job and only bring back distinct rtf files.</p>
  
  <pre><code>procedure GroupHeader17OnBeforePrint(Sender: TfrxComponent );
  var
         CarGroup: String     ;
         CarGroupLoop: String;
  begin
                         CarGroup := Memo93.Value;
                         CarGroupLoop :=  &lt;table."Class"&gt;;
                         if not(CarGroup = CarGroupLoop) then
                         begin
                                 try
                                         GroupHeader17.Visible := TRUE;
                                         rich23.richedit.lines.LoadFromFile('example\'+ trim(Get('@QteLanguage'))+ '\'+ trim(Get('@QteLanguage'))+'_Group_'+ trim( &lt;table."Class"&gt;)+ '.rtf');
  
                                 except
                                         GroupHeader17.Visible := FALSE;
  
                                 end;
                         end
                         else
                         begin
                                 GroupHeader17.Visible := False;
                         end;
  
  
  
  end;
  </code></pre>