Web API Reference | MapGuide Open Source

- Overview
- Modules
- Classes

# MgUpdateFeatures Class Reference
[MgUpdateFeatures]

Creates an update feature data command. You must add this command to an MgFeatureCommandCollection object and pass the latter in a call to MgFeatureService::UpdateFeatures. More...

Inherits MgFeatureCommand.

List of all members.

## Public Member Functions
INT32 | GetCommandType () const
| Gets the type of the command, that is, MgFeatureCommandType::UpdateFeatures.
STRING | GetFeatureClassName () const
STRING | GetFilterText () const
MgPropertyCollection * | GetPropertyValues () const
| MgUpdateFeatures (CREFSTRING className, MgPropertyCollection *propertyValues, CREFSTRING filterText)
| Constructs an MgUpdateFeatures object.

## Detailed Description

Creates an update feature data command. You must add this command to an MgFeatureCommandCollection object and pass the latter in a call to MgFeatureService::UpdateFeatures.

Remarks:
  You can change the values of the properties of one feature by setting the filter to select that feature, or you can do a global change on the values of the properties of many features by setting the filter to select those features. See filter and expressions for instruction on how to set the filter. If you want to change the properties of many features so that each of those properties has a different value, then you must create one update command for each feature.

  ## Procedure

1. Get the property definitions for the class. See MgClassDefinition::GetProperties Method . As a minimum, you must create property values for each of the properties defined as mandatory. See MgDataPropertyDefinition::GetNullable Method and MgRasterPropertyDefinition::GetNullable Method .
2. Create a property object for each property value appropriate to the type of the value; for example, use the MgGeometryProperty class to create an object containing a geometry value and use the MgBooleanProperty class to create an object containing a boolean value; the property class constructor is passed the name of the property and its value. See Feature Properties .
3. Add each property object to an MgPropertyCollection object
4. Create the update command. Pass the class name, the property collection, and the filter text expression to the MgUpdateFeatures::MgUpdateFeatures Constructor (CREFSTRING, MgPropertyCollection*, CREFSTRING) .
5. Add the MgInsertFeatures object to an MgFeatureCommandCollection object.
6. Execute the MgFeatureServices::UpdateFeatures() method; the arguments are a resource identifier for the feature source and the MgFeatureCommandCollection object.
7. Check the result. The result is an MgPropertyCollection object. For each update command, there will be one property of type MgPropertyType::Int32 in the returned collection. The index of this property matches the index of the update command in the feature command collection passed to MgFeatureService::UpdateFeatures.

Comments or suggestions? Send us feedback.