Helper function - generates a SetItemField which tells Exchange you want to overwrite the contents of a field.
508326
def update_property_node(node_to_insert, field_uri):
  
  root = T.SetItemField(
            T.FieldURI(FieldURI=field_uri),
            T.CalendarItem(node_to_insert)
        )
  return root
983900
function fieldAssign(elem, field, val) {
        try {
            $(exports).triggerHandler('fieldAssign', [elem, field, val]);
        } catch (err) {
            console.error(err);
        }
        var isCustomField = (elem[field] && elem[field].__read);
        var oldVal;
        if (isCustomField) {
            oldVal = elem[field].__write();
        } else {
            oldVal = elem[field];
        }
        _currentOperation.ops.push({
            op: OP_FIELD_ASSIGN,
            arg: {
                _id: elem._id,
                f: field,
                n: val,
                o: oldVal
            }
        });
    }
631030
def setField(self, new_value):
        
        self.field_strength = self.field_strength._replace(
            val=new_value
        )
176346
def _set_cached_value(self, xblock, value):
        """"""
        # pylint: disable=protected-access
        if not hasattr(xblock, '_field_data_cache'):
            xblock._field_data_cache = {}
        xblock._field_data_cache[self.name] = value
1105143
def mutate(self, field):
        
        new_val = self.next_val(field)
        field._pfp__set_value(new_val)
        return field
1309324
function import($overwritesettings) {
        global $DB, $CFG;

        $params = $this->get_preset_settings();
        $settings = $params->settings;
        $newfields = $params->importfields;
        $currentfields = $params->currentfields;
        $preservedfields = array();

        /* Maps fields and makes new ones */
        if (!empty($newfields)) {
            /* We require an injective mapping, and need to know what to protect */
            foreach ($newfields as $nid => $newfield) {
                $cid = optional_param("field_$nid", -1, PARAM_INT);
                if ($cid == -1) {
                    continue;
                }
                if (array_key_exists($cid, $preservedfields)){
                    print_error('notinjectivemap', 'data');
                }
                else $preservedfields[$cid] = true;
            }

            foreach ($newfields as $nid => $newfield) {
                $cid = optional_param("field_$nid", -1, PARAM_INT);

                /* A mapping. Just need to change field params. Data kept. */
                if ($cid != -1 and isset($currentfields[$cid])) {
                    $fieldobject = data_get_field_from_id($currentfields[$cid]->id, $this->module);
                    foreach ($newfield as $param => $value) {
                        if ($param != "id") {
                            $fieldobject->field->$param = $value;
                        }
                    }
                    unset($fieldobject->field->similarfield);
                    $fieldobject->update_field();
                    unset($fieldobject);
                } else {
                    /* Make a new field */
                    include_once("field/$newfield->type/field.class.php");

                    if (!isset($newfield->description)) {
                        $newfield->description = '';
                    }
                    $classname = 'data_field_'.$newfield->type;
                    $fieldclass = new $classname($newfield, $this->module);
                    $fieldclass->insert_field();
                    unset($fieldclass);
                }
            }
        }

        /* Get rid of all old unused data */
        if (!empty($preservedfields)) {
            foreach ($currentfields as $cid => $currentfield) {
                if (!array_key_exists($cid, $preservedfields)) {
                    /* Data not used anymore so wipe! */
                    print "Deleting field $currentfield->name<br />";

                    $id = $currentfield->id;
                    //Why delete existing data records and related comments/ratings??
                    $DB->delete_records('data_content', array('fieldid'=>$id));
                    $DB->delete_records('data_fields', array('id'=>$id));
                }
            }
        }

        // handle special settings here
        if (!empty($settings->defaultsort)) {
            if (is_numeric($settings->defaultsort)) {
                // old broken value
                $settings->defaultsort = 0;
            } else {
                $settings->defaultsort = (int)$DB->get_field('data_fields', 'id', array('dataid'=>$this->module->id, 'name'=>$settings->defaultsort));
            }
        } else {
            $settings->defaultsort = 0;
        }

        // do we want to overwrite all current database settings?
        if ($overwritesettings) {
            // all supported settings
            $overwrite = array_keys((array)$settings);
        } else {
            // only templates and sorting
            $overwrite = array('singletemplate', 'listtemplate', 'listtemplateheader', 'listtemplatefooter',
                               'addtemplate', 'rsstemplate', 'rsstitletemplate', 'csstemplate', 'jstemplate',
                               'asearchtemplate', 'defaultsortdir', 'defaultsort');
        }

        // now overwrite current data settings
        foreach ($this->module as $prop=>$unused) {
            if (in_array($prop, $overwrite)) {
                $this->module->$prop = $settings->$prop;
            }
        }

        data_update_instance($this->module);

        return $this->cleanup();
    }
397333
public function offsetSet($index, $item) : void
    {
        if ($item instanceof Fieldset) {
            foreach ($item as $subitem) {
                $this->setValue($subitem);
            }
        } else {
            $this->setValue($item);
        }
        parent::offsetSet($index, $item);
    }
265331
def set(self, field, clusters, value, add_to_stack=True):
        """"""
        # Add the field if it doesn't exist.
        if field not in self._fields:
            self.add_field(field)
        assert field in self._fields

        clusters = _as_list(clusters)
        for cluster in clusters:
            if cluster not in self._data:
                self._data[cluster] = {}
            self._data[cluster][field] = value

        up = UpdateInfo(description='metadata_' + field,
                        metadata_changed=clusters,
                        metadata_value=value,
                        )
        undo_state = self.emit('request_undo_state', up)

        if add_to_stack:
            self._undo_stack.add((clusters, field, value, up, undo_state))
            self.emit('cluster', up)

        return up
751376
public void transferItem() {
    Metadata metadata = metadatas.get(index);
    List<?> values = (List<?>) ((List<?>) context.get("items")).get(index);
    getWriter().writeTitle(metadata.dataName, metadata.titles);
    Object[] propValues = new Object[metadata.attrs.length];
    for (Object item : values) {
      for (int i = 0; i < propValues.length; i++) {
        try {
          propValues[i] = propertyExtractor.getPropertyValue(item, metadata.attrs[i]);
        } catch (Exception e) {
          transferResult.addFailure(TransferMessage.ERROR_ATTRS_EXPORT,
              "occur in get property :" + metadata.attrs[i] + " and exception:" + e.getMessage());
        }
      }
      writer.write(propValues);
    }
  }
629401
def set_field(self, name, value, parse=False):
        
        # explicit getitem needed for ValueField
        try: 
            item = dict.__getitem__(self, name)
            item.set( item.parse(value) if parse else value  )
        except ValidationError as err:
            raise FieldValidationError(name, value, list(err))
39556
function setItem(key, value, callback) {
	        var self = this;

	        // Cast the key to a string, as that's all we can set as a key.
	        if (typeof key !== 'string') {
	            globalObject.console.warn(key + ' used as a key, but it is not a string.');
	            key = String(key);
	        }

	        var promise = self.ready().then(function () {
	            // Convert undefined values to null.
	            // https://github.com/mozilla/localForage/pull/42
	            if (value === undefined) {
	                value = null;
	            }

	            // Save the original value to pass to the callback.
	            var originalValue = value;

	            return new Promise(function (resolve, reject) {
	                var dbInfo = self._dbInfo;
	                dbInfo.serializer.serialize(value, function (value, error) {
	                    if (error) {
	                        reject(error);
	                    } else {
	                        try {
	                            localStorage.setItem(dbInfo.keyPrefix + key, value);
	                            resolve(originalValue);
	                        } catch (e) {
	                            // localStorage capacity exceeded.
	                            // TODO: Make this a specific error/event.
	                            if (e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') {
	                                reject(e);
	                            }
	                            reject(e);
	                        }
	                    }
	                });
	            });
	        });

	        executeCallback(promise, callback);
	        return promise;
	    }
509946
def set_item(self,item):
        ""
        self.item = self.x.process_one(item)
        yield None
        self.item = None
69279
def set(key, value, overwrite: true)
      result = if overwrite
        self.connection.hset(@key, key, value)
      else
        self.connection.hsetnx(@key, key, value)
      end

      return coerce_bool(result)
    end
203258
def set(self, element_to_set, value):
        """"""
        self._elk.send(ts_encode(self.index, value, element_to_set))
983444
def set(self, value):
        
        old_value = self._value
        old_raw_str_value = self.raw_str_value

        self.type.set_item_value(self, value)

        new_value = self._value

        if old_value is not_set and new_value is not_set:
            # Nothing to report
            return

        if self.section:
            self.section.dispatch_event(
                self.section.hooks.item_value_changed,
                item=self,
                old_value=old_value,
                new_value=new_value,
                old_raw_str_value=old_raw_str_value,
                new_raw_str_value=self.raw_str_value
            )
1228437
function () {

    var items = Array.prototype.slice.call(arguments);
    this.source.unshift.apply(this.source, items);
    this._updateInfo();

    // DEPRECATED
    this.emit("insert", items[0], 0);
    this.emit("update", { insert: items });
  }
638743
function setNestedValue(data, field, value) {
        var fieldParts = _.isArray(field) ? field : field.split('.');

        // if no nesting, just set the value
        if (fieldParts.length === 1) {
            data[field] = _.isString(value) ? value.trim() : value;
            return;
        }

        // make sure the parent value exists
        data[fieldParts[0]] = data[fieldParts[0]] || {};

        // recursively call to go down a level
        setNestedValue(data[fieldParts[0]], fieldParts.slice(1, fieldParts.length), value);
    }