Administration and Maintenance > Administer IDOL Server > Change Document Field Values

Change Document Field Values
You can change field values in documents using the following action:
DREREPLACE?DatabaseMatch=Databases\n\nData#DREENDDATA\n\n
 
where,
 
is a list of one or more databases in which to replace the specified data. If you specify multiple databases, separate them with plus symbols (there must be no space before or after a plus symbol).
#DREDBNAME databaseName
#DREDOCID id or #DREDOCREF url or #DRESTATEID stateID
#DREFIELDVALUE fieldValue
#DREFIELDBITOR value (#DREFIELDBITAND value or #DREFIELDBITXOR value)
 
Table 8 DREREPLACE Data Fields
Match all documents. This option is restricted only by the DatabaseMatch parameter supplied as part of the DREREPLACE request, or by database read-only status.
#DREDBNAME databaseName
The databases within which to match all documents. To specify more than one database, separate them with plus signs (+). IDOL server ignores the DatabaseMatch parameter for the documents identified by #DREDBNAME.
The stored state ID of an array of documents containing the field to change or delete. The state ID returns from a query where StoreState=true.
The name of the field whose value you want to change or delete. Note that in XML documents, fieldName must be fully qualified (for example, XML/DOCUMENT/MYFIELD).
#DREFIELDVALUE fieldValue
The new value for the field specified by fieldName if the fieldName/fieldValue pair does not already exist.
The new value for the field specified by fieldName if the fieldName does not already exist in the document.
The value the field specified by fieldName must contain for the field to be deleted.
The value the field specified by fieldName must contain for IDOL server to delete it. This option deletes only the first instance of the fieldName/fieldValue pair.
The wildcard value that the field specified by fieldName must contain for the field to be deleted. This operation matches wildcards for UTF-8 (that is, ? matches a single UTF-8 character).
The wildcard value that the field specified by fieldName must contain for the first instance of the field to be deleted. This operation deletes only a single instance of the fieldName/fieldValue pair. It matches wildcards for UTF-8 (that is, ? matches a single UTF-8 character).
*
If this field is a NumericType field with the NumericIntegerOnly property, then the value is a signed 64-bit integer.
*
If the field is a BitFieldType field, the value must be a hexadecimal value.
IDOL server performs the bitwise or operation on the field identified by the previous #DREFIELDNAME. For NumericType fields, if the field is not present in the document, then it adds a field with value 0000000000 first, and then applies the bit operation.
To specify multiple instances of #DREDOCID, #DREDOCREF, or #DRESTATEID, separate the entries with a percent-encoded plus sign or comma.
For example: #DREDOCID 1,3,7-10 or #DREDOCID REF1+REF2+REF3. You must also set ReplaceAllRefs=true to perform actions on multiple documents.
 
NOTE Autonomy generally recommends that you do not replace values in Index or ACLType fields, because IDOL server must re-index the documents being changed, which can slow the update process. Changes to numerical fields, numerical date fields, or fields with other properties, execute without re-indexing and so occur quickly.
Related Topics 
*
*
Examples
DREREPLACE?DATABASEMATCH=News+Archive HTTP/1.0\n
Content-Length:203\n\n
 
#DREDOCID 1\n
#DREFIELDNAME Price\n
#DREFIELDVALUE 10\n
#DREFIELDNAME Color\n
#DREFIELDVALUE Red\n
 
#DREDOCREF http://www.autonomy.com/autonomy/dynamic/autopage442.shtml\n
#DREFIELDNAME Country\n
#DREFIELDVALUE UK\n
#DREFIELDNAME Region\n
#DREFIELDVALUE South East\n
#DREFIELDNAME OnSale\n
#DREDELETEFIELDVALUE Yes\n
 
#DRESTATEID abcdefg-6\n
#DREFIELDNAME Fruit\n
#DREFIELDVALUEIFNOTFOUND mango\n
#DREDELETESINGLEFIELDVALUE apple\n
#DREDELETEFIELD XML/DOC/DELETEME\n
 
#DREENDDATANOOP\n\n
In this example, the DREREPLACE makes these changes in the News and Archive databases.
*
*
The value of the Price field changes to 10.
*
The value of the Color field changes to Red.
*
In the document with the reference http://www.autonomy.com/autonomy/dynamic/autopage442.shtml:
*
The value of the Country field changes to UK.
*
The value of the Region field changes to South East.
*
The field OnSale is removed from the document if it has the value Yes.
*
*
The value of the Fruit field changes to mango if the Fruit/mango pair does not already exist.
*
If the Fruit field contains the value apple, a single instance of the Fruit/apple pair is deleted.
*
All instances of the XML/DOC/DELETEME field are deleted.
*
#DREENDDATANOOP signifies the end of the action parameters.
Editing BitField Values
The following example demonstrates how to use a DREREPLACE action to edit the set information held in BitFieldType fields.
DREREPLACE?ReplaceAllRefs=true HTTP/1.0\n
Content-Length:203\n\n
 
#DREALL \n
#DREFIELDNAME BitField\n
#DREFIELDVALUEIFNOFIELD A008\n
#DREFIELDBITOR A008\n
 
#DREDOCID 1274\n
#DREFIELDNAME Workbook\n
#DREFIELDBITXOR 98\n
 
#DREDBNAME News\n
#DREFIELDNAME NewsSets\n
#DREFIELDBITAND D9\n
 
#DREENDDATANOOP\n\n
 
NOTE The BitField, Workbook and NewsSets fields used in this example must be BitFieldType fields.
In this example, the DREREPLACE makes these changes.
*
*
If there is no BitField field, IDOL server adds one with the value A008.
*
IDOL server changes the value in the BitField field by performing a bitwise OR operation between the current value of the field and the value A008.
For example, if the current value of the field is 8080:
 
The result of the bitwise OR is that any binary digits that were set to 1 (indicating that the document was part of the set) are left as they are. In addition, all the documents have the bits set to 1 for the third, 13th, and 15th sets, if it was not already set. In this way, all the documents are marked as part of sets 3, 13, and 15.
In this example, the document is marked as part of set 3, while remaining a part of sets 7, 11, 13, and 15.
*
*
IDOL server changes the value in the Workbook field by performing a bitwise XOR operation between the current value of the field and the value 98. For example, if the current value of the field is 6C:
 
The result of the bitwise XOR is that any binary digits that are set to 1 in either number (but not in both) are set to 1 in the result. If the document was not already part of sets 3, 4, or 7, then IDOL server adds it to those sets. However, if the bit is set to 1 or 0 in both numbers, it is set to 0 in the result. If a document is already part of sets 3, 4, or 7, it is removed from them.
In this example, IDOL server adds the document to sets 4 and 7. It remains part of sets 2, 5, and 6, but IDOL server removes it from set 3.
*
*
IDOL server changes the value in the NewsSets field by performing a bitwise AND operation between the current value of the field and the value D9.
For example, if the current value of the field is 6C:
 
The result of the bitwise AND is that any binary digits that are set to 1 in both numbers are set to 1 in the result. If a document is already part of set 0, 3, 4, 6, or 7, it remains a part of those sets, but it is not be added if it was not originally part of those sets. It is also removed from any other sets it was initially part of.
In this example, the document remains in set 3 and set 6, but IDOL server removes it from sets 2 and 5.
*
#DREENDDATANOOP signifies the end of the action parameters.
Related Topics 
*