def _build_summary_string(violation_id, error_type, test_id, row_number,
    test_def):
    """
    build qa result summary message like so:
    [violation-id]-[error-type]-[test-id]-[table]    -[table index]-[field]-[row number]-[message]

    :returns: summary string
    """
    function = test_def['function']
    msg_stem = 'WOUDC data quality assessment failed.'
    messages = {'RC_1': 
        '%s Due to value = x outside the range:a <= x <= b, where a=A, b=B' %
        msg_stem, 'RC_5': '%s Due to value is less then A' % msg_stem,
        'RC_6': '%s Due to value is greater then A' % msg_stem}
    if function in messages.keys():
        msg = messages[function]
        msg = msg.replace('A', test_def['function_parameter_a'])
        if function == 'RC_1':
            msg = msg.replace('B', test_def['function_parameter_b'])
    else:
        return None
    table = test_def['table']
    table_ix = test_def['table_index']
    field = test_def['element']
    summary = '%s-%s-%s-%s-%s-%s-%s-%s' % (violation_id, error_type,
        test_id, table, table_ix, field, row_number, msg)
    return summary
