【问题标题】:How to store data into a collection form string in Blue Prism如何将数据存储到 Blue Prism 中的集合表单字符串中
【发布时间】:2019-01-25 20:11:12
【问题描述】:

目前正在开发 Blue Prism V5.0,现在我正在使用 BP 中的代码块,现在我的目标是获取给定文件夹/路径中的所有文件名。为此,我使用的是 C# 代码。

String[] str = Directory.GetFiles(inputFolderPath);

为此,我通过相同的代码块提供输入文件/文件夹路径,文件的输出默认为字符串,但 BP 没有字符串类型,因此,如何将数据类型字符串转换为集合.

任何建议都会有所帮助。

提前致谢

【问题讨论】:

    标签: c# blueprism rpa


    【解决方案1】:

    嗯,有标准的 BluePrism 动作可以做到这一点!

    Object: Utility - File Management
    Action: Get Files
    

    非常好,因为它确实输出了很多列,包括:文件名和文件路径、扩展名、大小等等。

    它还允许过滤结果。示例可能是“.*pdf”,它应该强制操作只返回具有该扩展名的文件。

    【讨论】:

      【解决方案2】:

      将输出添加到 Collection (System.Data.DataTable) 类型的代码阶段。然后,手动将String[] 转换为DataTable:

      outputCollection = new DataTable(); // might not be necessary as Blue Prism will generally instantiate the instance for you; remove this line if you're receiving compiler warnings/errors
      
      // create a column to store your paths
      DataColumn col = new DataColumn();
      col.DataType = System.Type.GetType("System.String")
      col.ColumnName = "Filename";
      outputCollection.Columns.Add(col);
      
      // loop through the String[] array and place the values in the DataTable structure
      foreach (String el in str) {
          DataRow row = outputCollection.NewRow();
          row["Filename"] = el;
          outputCollection.Rows.Add(row);
      }
      

      当这被输出回您的 Blue Prism 工作流程时,您将在“文本”数据类型的输出集合中拥有一列。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-11-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-01-17
        相关资源
        最近更新 更多