Show / Hide Table of Contents

    How to use batch update

    For batch update, the following parts are needed:.
    A BatchAppendKeywordValues object which requires DocId, FieldName and Keyword property.
    Also, you can create a BatchUpdateProcess object which needs to be created with a source of BatchUpdateDocumentsSource or BatchUpdateDialogExpressionSource.
    The index fields which you want to change in those objects are located in the BatchUpdateProcessData Field property.

    BatchAppendKeywordValues

    Sync

    How to append to a keyword index field.

    List<int> documentIds = new List<int>()
    {
        123
    };
    
    List<string> keywords = new List<string>()
    {
        "Value to append"
    };
    
    BatchUpdateIndexFieldsResult batchUpdateIndexFieldsResult = BatchAppendKeywordValuesInFileCabinet(fileCabinet, documentIds, keywords, "DBNAMEKEYWORDINDEXFIELD");
    
    public static BatchUpdateIndexFieldsResult BatchAppendKeywordValuesInFileCabinet(FileCabinet fileCabinet, List<int> documentIds, List<string> keywords, string fieldName)
    {
        return fileCabinet.PostToBatchUpdateRelationForBatchUpdateIndexFieldsResult(
        new BatchAppendKeywordValues
        {
            DocId = documentIds,
            Keyword = keywords,
            FieldName = fieldName
        });
    }
    

    Async

    How to append to a keyword index field.

    List<int> documentIds = new List<int>()
    {
        123
    };
    
    List<string> keywords = new List<string>()
    {
        "Value to append"
    };
    
    DeserializedHttpResponse<BatchUpdateIndexFieldsResult> batchUpdateIndexFieldsResult = await BatchAppendKeywordValuesInFileCabinetAsync(fileCabinet, documentIds, keywords, "DBNAMEKEYWORDINDEXFIELD");
    
    public static async Task<DeserializedHttpResponse<BatchUpdateIndexFieldsResult>> BatchAppendKeywordValuesInFileCabinetAsync(FileCabinet fileCabinet, List<int> documentIds, List<string> keywords, string fieldName)
    {
        return await fileCabinet.PostToBatchUpdateRelationForBatchUpdateIndexFieldsResultAsync(
        new BatchAppendKeywordValues
        {
            DocId = documentIds,
            Keyword = keywords,
            FieldName = fieldName
        });
    }
    

    BatchUpdateProcess

    Sync

    Use list of document ids for batch update.

    List<int> documentIds = new List<int>()
    {
        123
    }
    
    List<DialogExpressionCondition> updateFields = new List<DocumentIndexField>()
    {
        DocumentIndexField.Create("DBFIELDNAME", "VALUE")
    }
    
    BatchUpdateIndexFieldsResult batchUpdateIndexFieldsResult = BatchUpdateInFileCabinet(fileCabinet, documentIds, updateFields);
    
    public static BatchUpdateIndexFieldsResult BatchUpdateInFileCabinet(FileCabinet fileCabinet, List<int> documentIds, List<DialogExpressionCondition> updateFields)
    {
        return fileCabinet.PostToBatchUpdateRelationForBatchUpdateIndexFieldsResult(new BatchUpdateProcess
        {
            Source = new BatchUpdateDocumentsSource
            {
                Id = documentIds
            },
            Data = new BatchUpdateProcessData
            {
                Field = updateFields
            }
        });
    }
    

    Use search expression for batch update.

    BatchUpdateDialogExpressionSource batchUpdateDialogExpressionSource = new BatchUpdateDialogExpressionSource
    {
        Expression = new DialogExpression
        {
            Condition = new List<DialogExpressionCondition>
            {
                DialogExpressionCondition.Create("DBFIELDNAME", "VALUE")
            },
            Operation = DialogExpressionOperation.And
        }
    };
    
    List<DialogExpressionCondition> updateFields = new List<DocumentIndexField>()
    {
        DocumentIndexField.Create("DBFIELDNAME", "VALUE")
    };
    
    BatchUpdateIndexFieldsResult batchUpdateIndexFieldsResult = BatchUpdateInFileCabinet(fileCabinet, documentIds, updateFields);
    
    public static BatchUpdateIndexFieldsResult BatchUpdateInFileCabinet(FileCabinet fileCabinet, BatchUpdateDialogExpressionSource batchUpdateDialogExpressionSource, List<DialogExpressionCondition> updateFields)
    {
        return fileCabinet.PostToBatchUpdateRelationForBatchUpdateIndexFieldsResult(new BatchUpdateProcess
        {
            Source = batchUpdateDialogExpressionSource,
            Data = new BatchUpdateProcessData
            {
                Field = updateFields
            }
        });
    }
    

    Async

    Use list of document ids for batch update.

    public static async Task
    List<int> documentIds = new List<int>()
    {
        1
    };
    
    List<DialogExpressionCondition> updateFields = new List<DocumentIndexField>()
    {
        DocumentIndexField.Create("DBFIELDNAME", "VALUE")
    };
    
    DeserializedHttpResponse<BatchUpdateIndexFieldsResult> batchUpdateIndexFieldsResultAsync = await BatchUpdateInFileCabinetAsync BatchUpdateInFileCabinet(fileCabinet, documentIds, updateFields);
    
    public static async Task<DeserializedHttpResponse<BatchUpdateIndexFieldsResult>> BatchUpdateInFileCabinet(FileCabinet fileCabinet, List<int> documentIds, List<DialogExpressionCondition> updateFields)
    {
        return await fileCabinet.PostToBatchUpdateRelationForBatchUpdateIndexFieldsResultAsync(new BatchUpdateProcess
        {
            Source = new BatchUpdateDocumentsSource
            {
                Id = documentIds
            },
            Data = new BatchUpdateProcessData
            {
                Field = updateFields
            }
        });
    }
    

    Use search expression for batch update.

    BatchUpdateDialogExpressionSource batchUpdateDialogExpressionSource = new BatchUpdateDialogExpressionSource
    {
        Expression = new DialogExpression
        {
            Condition = new List<DialogExpressionCondition>
            {
                DialogExpressionCondition.Create("DBFIELDNAME", "VALUE")
            },
            Operation = DialogExpressionOperation.And
        }
    };
    
    List<DialogExpressionCondition> updateFields = new List<DocumentIndexField>()
    {
        DocumentIndexField.Create("DBFIELDNAME", "VALUE")
    };
    
    DeserializedHttpResponse<BatchUpdateIndexFieldsResult> batchUpdateIndexFieldsResultAsync = await BatchUpdateInFileCabinetAsync(fileCabinet, documentIds, updateFields);
    
    public static async Task<DeserializedHttpResponse<BatchUpdateIndexFieldsResult>> BatchUpdateInFileCabinetAsync(FileCabinet fileCabinet, BatchUpdateDialogExpressionSource batchUpdateDialogExpressionSource, List<DialogExpressionCondition> updateFields)
    {
        return await fileCabinet.PostToBatchUpdateRelationForBatchUpdateIndexFieldsResultAsync(new BatchUpdateProcess
        {
            Source = batchUpdateDialogExpressionSource,
            Data = new BatchUpdateProcessData
            {
                Field = updateFields
            }
        });
    }
    
    About Us Contact Imprint Terms Data privacy
    © 2024 DocuWare Corporation powered by DocFX Back to top