title: Concatenate distinct values within one column in crystal reports
body: <p>i have a recordset in details section</p>
  
  <p>Example:</p>
  
  <pre><code>Column1----Column2
  value_1----5678976
  value_2----7263535
  value_1----1938773
  value_2----3333445
  value_3----2848465
  </code></pre>
  
  <p>So at the report header, i need to specify all distinctive values from Column1, comma separated. From mentioned example correct string will be:</p>
  
  <pre><code>value_1,value_2,value_3
  </code></pre>
  
  <p>I tried to use formula</p>
  
  <pre><code>WhilePrintingRecords;
  shared stringvar final_result;
  shared stringvar current_value;
  
  if len(final_result) = 0 then final_result = "";
  
  current_value:= {Column1};
  final_result := final_result+ "," + current_value;
  </code></pre>
  
  <p>This is doesn't work</p>
  
  <p>Tried different one</p>
  
  <pre><code>WhilePrintingRecords;
  stringVar final_result := "";
  final_result = final_result + (
  if InStr(final_result, {Column1}) &gt; 0 then ""
  else final_result := "," + {Column1};
  );
  </code></pre>
  
  <p>Also no result.
  Where did i go wrong?</p>
  
  <p>Thanks</p>