def write_result
      sum_line = [sum_row_title] + [''] * (key_titles.size - 1)
      headline = heading_sort ? heading.sort : original_pivot_sequence_heading
      headline << add_sum_col unless sum_col_title.nil?
      headline.each do |h|
        sum_line << sums[h]
      end
      row = 0;
      File.open(outfile, 'w') do |out|
        out.puts sum_line.join(';') if row == sum_row ; row += 1
        out.puts (key_titles + headline).join(';')
        key_values.each do |k,v|
          out.puts sum_line.join(';') if row == sum_row ; row += 1
          line = [k]
          headline.each do |h|
            line << v[:elements][h] unless h == sum_col_title
          end
          line << v[:sum] unless sum_col_title.nil?
          out.puts line.join(';')
        end
      end
    end
def write_result
      sum_line = [sum_row_title] + [''] * (key_titles.size - 1)
      headline = heading_sort ? heading.sort : original_pivot_sequence_heading
      headline << add_sum_col unless sum_col_title.nil?
      headline.each do |h|
        sum_line << sums[h]
      end
      row = 0;
      File.open(outfile, 'w') do |out|
        out.puts sum_line.join(';') if row == sum_row ; row += 1
        out.puts (key_titles + headline).join(';')
        key_values.each do |k,v|
          out.puts sum_line.join(';') if row == sum_row ; row += 1
          line = [k]
          headline.each do |h|
            line << v[:elements][h] unless h == sum_col_title
          end
          line << v[:sum] unless sum_col_title.nil?
          out.puts line.join(';')
        end
      end
    end
Writes the count results