IDOL Server 24.2

# 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.example.com/example/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 the following changes in the `News` and `Archive` databases:

- In the document with the ID 1:

  - 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.example.com/example/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`.

- In the documents referenced in the state ID `abcdefg–6`:

  - 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.

## Edit 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 the following changes:

- In all documents in the IDOL Content component:

  - If there is no `BitField` field, Content adds one with the value `A008`.

  - Content 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`:

    Hexadecimal | Binary |
    --- | --- | ---
    8080 | 1000 0000 1000 0000 |
    A008 | 1010 0000 0000 1000 |
    | 1010 0000 1000 1000 | The new field value is `A088`

    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, thirteenth, and fifteenth 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.

- In the document with ID 1274:

  - Content 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`:

    Hexadecimal | Binary |
    --- | --- | ---
    6C | 0110 1100 |
    98 | 1001 1000 |
    | 1111 0100 | The new field value is `F4`

    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, Content 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, Content adds the document to sets 4 and 7. It remains part of sets 2, 5, and 6, but Content removes it from set 3.

- In all documents in the `News` database:

  - Content 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`:

    Hexadecimal | Binary |
    --- | --- | ---
    6C | 0110 1100 |
    D9 | 1101 1001 |
    | 0100 1000 | The new field value is `48`

    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 Content removes it from sets 2 and 5.

- `#DREENDDATANOOP` signifies the end of the action parameters.

Related Topics

- BitFieldType Fields

Copyright 2024 Open Text
Version 24.2 | Last updated March 2024

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: IDOL Server 24.2

Topic Title: Examples