c# - 导出连接器 - 处理 KTM 表结构
问题描述
我有一个导出脚本,它导出一个简单的字段映射。所以在设置方面,我试图将我自己的字段从外部应用程序映射到 Kofax 字段
- myField1 => KfxIndexField3
- myField2 => KfxIndexField656
- myField3 => KfxIndexField54758
我有一个由 KTM 处理的批处理类。正如您在下图中看到的那样,有一个TABLE
带有子字段的字段。
在设置方面,我添加了一些选择控件。用户可以选择 Indexfields、Batchfields 和 BatchVariables。我通过 和 访问这releaseSetupData.IndexFields
3releaseSetupData.BatchFields
个releaseSetupData.BatchVariableNames
。
不幸的是,TABLE
get 中的子项目以正常方式列为 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
(表中的项目)在发布期间不作为索引字段存在。那么我应该如何处理这些字段呢?
- 如果没有办法,为什么它们会作为索引字段(在
releaseSetupData.IndexFields
)出现在设置端?我怎样才能排除它们? - 如果有办法,我如何检查这是否与 KTM 相关并提取表格?
一个关键的解决方法是创建一个自定义模块并在之前映射 KTM 数据......
解决方案
我想我成功了。我必须检查TableName
该字段是否为空。
设置:
似乎这样的 KTM 表只影响IndexField
s。对于那些我能做的
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;
}
}
}
}
推荐阅读
- java - Selenium Webdriver 在 Web 元素中查找 Web 元素
- google-docs-api - 是否可以使用 Google Docs API 触发“设置我的默认样式”?
- sql - 将结果从存储过程返回到另一个存储过程
- c++ - 以类为类型名的模板变量
- typescript - JSDoc 相当于 Typescript 的 `as const`?
- python - 将散点图上的点与与颜色图相关的线连接起来
- python - galpy中的轨道积分,无需指定时间步长数组
- amazon-web-services - 更新了 AWS CLI,现在同步不起作用
- php - 你能算出数字吗?我的代码输出正确但不被接受?
- c - 在 C 中,为什么结构的第一个成员在使用 free() 释放时经常“重置”为 0?