首页 > 解决方案 > 导出连接器 - 处理 KTM 表结构

问题描述

我有一个导出脚本,它导出一个简单的字段映射。所以在设置方面,我试图将我自己的字段从外部应用程序映射到 Kofax 字段

我有一个由 KTM 处理的批处理类。正如您在下图中看到的那样,有一个TABLE带有子字段的字段。

在此处输入图像描述

在设置方面,我添加了一些选择控件。用户可以选择 Indexfields、Batchfields 和 BatchVariables。我通过 和 访问这releaseSetupData.IndexFields3releaseSetupData.BatchFieldsreleaseSetupData.BatchVariableNames

不幸的是,TABLEget 中的子项目以正常方式列为 IndexFields。在发布方面,我尝试使用此代码提取所有这些字段

    private void SetupFieldMapping(ReleaseData documentData)
    {
        Dictionary<string, string> indexFields = new Dictionary<string, string>();
        Dictionary<string, string> batchFields = new Dictionary<string, string>();
        Dictionary<string, string> kofaxValues = new Dictionary<string, string>();

        foreach (Value val in documentData.Values)
        {
            if (val.TableName.IsEmpty())
            {
                string sourceName = val.SourceName;
                string sourceValue = val.Value;

                switch (val.SourceType)
                {
                    case KfxLinkSourceType.KFX_REL_INDEXFIELD:
                        indexFields.Add(sourceName, sourceValue);
                        break;

                    case KfxLinkSourceType.KFX_REL_VARIABLE:
                        kofaxValues.Add(sourceName, sourceValue);
                        break;

                    case KfxLinkSourceType.KFX_REL_BATCHFIELD:
                        batchFields.Add(sourceName, sourceValue);
                        break;
                }
            }
        }

        // ...
    }

配置的索引字段PO Number(表中的项目)在发布期间不作为索引字段存在。那么我应该如何处理这些字段呢?

一个关键的解决方法是创建一个自定义模块并在之前映射 KTM 数据......

标签: c#kofax

解决方案


我想我成功了。我必须检查TableName该字段是否为空。


设置:

似乎这样的 KTM 表只影响IndexFields。对于那些我能做的

foreach (IndexField field in releaseSetupData.IndexFields)
{
    bool isTableField = field.TableName != string.Empty;

    // e.g. skip if true
}

接口和BatchField动态批处理变量字段不提供TableName属性。


释放:

    private void SetupFieldMapping(ReleaseData documentData)
    {
        Dictionary<string, string> indexFields = new Dictionary<string, string>();
        Dictionary<string, string> batchFields = new Dictionary<string, string>();
        Dictionary<string, string> kofaxValues = new Dictionary<string, string>();

        foreach (Value val in documentData.Values)
        {
            string tableName = val.TableName;
            bool relatedToTable = tableName != string.Empty;
            string sourceName = val.SourceName;
            string sourceValue = val.Value;
            KfxLinkSourceType sourceType = val.SourceType;

            if (relatedToTable)
            {
                string[] columnValues = sourceValue.Split(';');

                // sourceName is the key of the subitem from the table
                // columnValues => values from all rows at the column "sourceName"

                // do stuff
            }
            else
            {
                switch (val.SourceType)
                {
                    case KfxLinkSourceType.KFX_REL_INDEXFIELD:
                        indexFields.Add(sourceName, sourceValue);
                        break;

                    case KfxLinkSourceType.KFX_REL_VARIABLE:
                        kofaxValues.Add(sourceName, sourceValue);
                        break;

                    case KfxLinkSourceType.KFX_REL_BATCHFIELD:
                        batchFields.Add(sourceName, sourceValue);
                        break;
                }
            }
        }
    }

推荐阅读