# mco_fh_record_set_field_SCALAR_TYPE

Set the value of a record’s scalar field.

### Prototype

        mco_fh_ret mco_fh_record_set_field_SCALAR_TYPE(/*IN*/ mco_fh_record_h rec,
                                /*IN*/ mco_offs_t field,
                                /*IN*/ SCALAR_TYPE val);

### Arguments

rec | The record handle
field | The index of the field in the record
val | The scalar type value to be set. The type must be one of the following:`bool, int1, int2, int4, int8, uint1, uint2, uint4, uint8, float, double` or `datetime` (for `datetime` values the expected resolution is nanoseconds. See page Managing Date/Time Fields in C for further details.)

### Description

> This function sets the value of a record’s scalar field.

### Return Codes

MCO_FH_OK | Record successfully destroyed
MCO_FH_E_BAD_HANDLE | The record handle is invalid

### Example

        ...
        // retrieve next quote from the feed
        FeedQuote *quote = feed->nextQuote();
        std::vector<TableInfo>::iterator it;
        for (it = tables.begin(); it != tables.end(); ++it)
        {
            // get handles of the previously created writer and record
            mco_fh_writer_t writer = it->writer;
            mco_fh_record_t record = it->record;
            // optionally, reset the record's contents
            mco_fh_record_zero_out(record);
            // fill only the required fields of the record
            for (size_t fieldIndex = 0; fieldIndex < it->fields.size(); fieldIndex++)
            {
                if (it->fields[fieldIndex] == "symbol")
                {
                    mco_fh_record_set_field_string(record, fieldIndex, quote->symbol);
                } else if (it->fields[fieldIndex] == "exchangeCode") {
                    mco_fh_record_set_field_int4(record, fieldIndex, quote->exchangeCode);
                } else if (it->fields[fieldIndex] == "bid") {
                    mco_fh_record_set_field_float(record, fieldIndex, quote->bid);
                } else if (it->fields[fieldIndex] == "ask") {
                    mco_fh_record_set_field_float(record, fieldIndex, quote->ask);
                } else if (it->fields[fieldIndex] == "isNBBO") {
                    mco_fh_record_set_field_bool(record, fieldIndex, quote->isNBBO);
                }
            }
            // write the record to the database
            mco_fh_writer_store_record(writer, record);
        }
        ...