0

假设我有一个名为的Appian 通用数据类型 (CDT)myTask,它包含多个字段taskName, taskQuarter, taskYear,taskId保存在一个局部变量(接口的)中,例如如下

+ 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

请问我该怎么做?

4

1 回答 1

0

结果很简单:假设您myGetAllTasks()定义了表达式规则,您可以将初始字典列表放入local!allTasks. 接下来,我们使用Appian的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
)
于 2021-04-27T12:48:45.510 回答