【问题标题】:The Appian way to add a derived field to a common data type on the fly?将派生字段动态添加到通用数据类型的 Appian 方式?
【发布时间】:2021-07-20 17:17:30
【问题描述】:

假设我有一个名为 myTaskAppian common data type (CDT) 包含多个字段 taskNametaskQuartertaskYeartaskId 保存在一个局部变量(Interface)中,它看起来像关注

+ data (List of dictionary)
  + (Dictionary)
    - taskName:    "Plant trees." (Text)
    - taskQuarter: 1              (Number (Integer))
    - taskYear:    2020           (Number (Integer))
    - taskId:      0              (Number (Integer))
  + (Dictionary)
    - taskName:    "Cut leaves." (Text)
    - taskQuarter: 2              (Number (Integer))
    - taskYear:    2020           (Number (Integer))
    - taskId:      1              (Number (Integer))

在(接口的)本地范围内,我想为所有记录添加一个名为taskLongName 的附加字段,这将是以下串联(在伪代码中):

taskLongName = taskName + " " + taskYear + " Q" + taskQuarter

请问我该怎么做?

【问题讨论】:

    标签: arrays concatenation appian


    【解决方案1】:

    结果很简单:假设您定义了表达式规则myGetAllTasks(),您可以将初始字典列表放入local!allTasks。接下来,我们使用Appian's a!forEach()函数:

    a!localVariables(
    local!allTasks: rule!myGetAllTasks().data, 
    local!taskLongNames: 
      a!foreach(
        items: local!allTasks,
        expression: concat(
          fv!item.taskName, " for ",
          fv!item.processYear, " Q",
          fv!item.processQuarter
        )
      ),
      ... <-- Here comes the configuration (code) defining the actual interface
    )
    

    【讨论】:

      猜你喜欢
      • 2014-12-13
      • 2023-03-23
      • 2019-03-03
      • 1970-01-01
      • 1970-01-01
      • 2022-01-19
      • 2012-06-05
      • 2020-07-31
      • 1970-01-01
      相关资源
      最近更新 更多