You can update records in a running data domain by replacing standard attribute and managed value assignments.
The updateRecords sub-operation of ingestChanges includes the replaceAssignments element that replaces assignments from records in the data domain.
This element replaces standard attribute assignments as well as managed value assignments. Similar to record replacement, if there are no assignments already in the data domain that match the new assignments, the assignment is still added.
Assignment replacement cannot be combined with any other operation that would modify the assignments to be replaced.
The updateRecords operation allows you to have only one recordSpecifier element. This element is expected to contain an EQL expression identifying one or more records. Therefore, if you combine more than one updating element inside an updateRecords operation, it is worth remembering that all updating operations (additions, deletions, and replacements) will run only on records identified by the EQL expression inside recordSpecifier.
If an attribute is multi-select and has more than one assignment value on some of the records, the replaceAssignments element deletes all of these assignments and adds the one assignment that you specify.
The replaceAssignments request can also rename an attribute in your data domain. For information, see Changing the name of a standard attribute.
If you submit the ingestChanges request after a Transaction Web Service request that starts an transaction, the request must specify the outer transaction ID. If no outer transactions have been started, the ID attribute must be omitted in the request.
The replaceAssignments element of the updateRecords sub-operation removes individual standard attribute and/or managed value assignments from the specified records in your data domain, and replaces them with new assignment values. You can replace one or more assignments in the same request.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.endeca.com/MDEX/ingest/3/0" xmlns:ns1="http://www.endeca.com/MDEX/XQuery/2009/09"> <soapenv:Header/> <soapenv:Body> <ns:ingestChanges> <ns:updateRecords> <ns:recordSpecifier>?</ns:recordSpecifier> <ns:replaceAssignments> <ns1:attribute name="?">?</ns1:attribute> </ns:replaceAssignments> </ns:updateRecords> </ns:ingestChanges> </soapenv:Body> </soapenv:Envelope>where the string that you add to a recordSpecifier element is an EQL expression identifying records.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.endeca.com/MDEX/ingest/3/0" xmlns:ns1="http://www.endeca.com/MDEX/XQuery/2009/09"> <soapenv:Header/> <soapenv:Body> <ns:ingestChanges> <ns:updateRecords> <ns:recordSpecifier>"price" > 5</ns:recordSpecifier> <ns:replaceAssignments> <ns1:attribute name="color">black</ns1:attribute> </ns:replaceAssignments> </ns:updateRecords> </ns:ingestChanges> </soapenv:Body> </soapenv:Envelope>
The example replaces all values of the color standard attribute assignment for all records whose values for the price attribute are higher than 5 with the value black.
<ingest:ingestChangesResponse xmlns:ingest="http://www.endeca.com/MDEX/ingest/3/0"> <ingest:numPropertiesCreated>0</ingest:numPropertiesCreated> <ingest:numRecordsAffected>7</ingest:numRecordsAffected> <ingest:numRecordsDeleted>0</ingest:numRecordsDeleted> </ingest:ingestChangesResponse>
The numRecordsAffected element in the response shows that seven records were successfully modified.