Lync Connector 25.4
Lync Connector Help

# Merge Document Fields

This script demonstrates how to merge the values of document fields.

When you extract data from a repository, the connector can produce documents that have multiple values for a single field, for example:

    #DREFIELD ATTACHMENT="attachment.txt"
    #DREFIELD ATTACHMENT="image.jpg"
    #DREFIELD ATTACHMENT="document.pdf"

This script shows how to merge the values of these fields, so that the values are contained in a single field, for example:

    #DREFIELD ATTACHMENTS="attachment.txt, image.jpg, document.pdf"

Copy

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    function handler(config, document, params)
        onefield(document,"ATTACHMENT","ATTACHMENTS")
        return true;
    end

    function onefield(document,existingfield,newfield)
        if document:hasField(existingfield) then
            local values = { document:getFieldValues(existingfield) }

            local newfieldvalue=""
            for i,v in ipairs(values) do
                if i>1 then
                    newfieldvalue = newfieldvalue ..", "
                end

                newfieldvalue = newfieldvalue..v
            end

            document:addField(newfield,newfieldvalue)
        end

        return true;
    end

Copyright 2025 Open Text
Version 25.4 | Last updated October 2025

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: Knowledge Discovery Lync Connector 25.4

Topic Title: Merge Document Fields