【问题标题】:How to Update KTA RunTimeField with an object?如何使用对象更新 KTA RunTimeField?
【发布时间】:2021-09-20 04:46:52
【问题描述】:

我正在尝试将一个对象(通用列表对象)更新为 RuntimeFiledCollection。当我尝试使用以下代码进行更新时,总是出现序列化错误:(

//My object which need to update set with the documentRuntimeField value
List<docInfo> docInfoList = new List<docInfo>
docInfo = new docInfo { ID = "11233", PageNumber = 1, text ="MyOwnText"};
docInfoList.Add(docInfo);

// Construct DOcument RuntimeFields Collection
var docRunTimeCollection = new CaptureDocumentService.RuntimeFieldCollection();
var docRunTimeField = new CaptureDocumentService.RuntimeField 
{ Name = "FieldName", Value = docInfoList };
docRunTimeCollection.Add(docRunTimeField);
captureDocumentServiceClient.UpdateDocumentFieldValues(sessionId, null, validDocumentId, docRunTimeCollection);

我总是收到如下所示的灭菌错误。有人可以给我一个示例,如何使用对象更新文档字段值。有什么帮助吗?

错误尝试序列化参数http://www.kofax.com/agilityservices/sdk:runtimeFields.InnerException时出错,消息是System.Collections.Generic.List

【问题讨论】:

  • 如果这是一个商业产品,我会问他们这个问题。毕竟你付了钱。

标签: c# .net kofax


【解决方案1】:

对于RuntimeField 类,您可以看到 Value 属性是 Object 类型,但这是一种误导,因为它不是任意容器。它采用您在提取组中为该字段定义的类型。但从本质上讲,这仅意味着 Date 字段需要 DateTime 或 Number 字段需要数字类型,其他任何内容都将转换为字符串。

如果您实际使用的是 Table Field,那么您不能使用 API 来设置整个表格的内容。您可以设置 RuntimeField.TableRow 和 RuntimeField.TableColumn 属性以使用 API 设置单个单元格。

【讨论】:

  • 嗨史蒂夫,你是对的。 Object 类型的 value 属性具有误导性。非常感谢您的澄清。只是想知道您是否有任何示例代码可以将表值列表设置为 RuntimeField 集合。
  • 我没有,但它只是在循环中调用API,您在其中设置RuntimeField.TableRow和RuntimeField.TableColumn,然后Value是Cell的值,而不是整个表.
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-18
  • 2020-05-20
  • 1970-01-01
  • 2021-02-02
相关资源
最近更新 更多