appian - 在字典中查找关联值
问题描述
我有一个条件,我需要获取任务代码为“LIFE_MAX_DAYS”的字典的 taskId 值。我能怎么做 ?
Dictionary
replFlag: null (Text)
taskCode: "LIFE_MAX_DAYS"
createdBy: "Administrator"
createdOn: 3/20/2020 1:54 AM EDT
lastModifiedBy: "Administrator"
lastModifiedOn: 3/20/2020 1:54 AM EDT
actionId: null (Number (Integer))
priorityId: 5
statusId: null (Number (Integer))
concatKey: null (Text)
taskId: 5980
batchId: null (Number (Integer))
id: 4
Dictionary
replFlag: null (Text)
taskCode: "LIFE_MAX_DAYS"
createdBy: "Administrator"
createdOn: 3/20/2020 1:54 AM EDT
lastModifiedBy: "Administrator"
lastModifiedOn: 3/20/2020 1:54 AM EDT
actionId: null (Number (Integer))
priorityId: 5
statusId: null (Number (Integer))
concatKey: null (Text)
taskId: 5980
batchId: null (Number (Integer))
id: 5
解决方案
wherecontains
查找提供数组值的索引。- 此外,列表支持多索引(例如
{"a", "b", "c", "d"}[{1, 3}]
返回{"a", "c"}
)。 - 最后列出支持预计索引(例如
{{x: 1}, {x: 2}, {x: 3}}.x
返回{1, 2, 3}
)
这三个功能允许您执行此操作:
with(
/* Pull out just the task codes of all the tasks */
taskCodesOfTasks: listOfTasks.taskCode,
/* Get the indicies where the task code is what we're looking for */
indicies: wherecontains("LIFE_MAX_DAYS", taskCodesOfTasks),
/* Pull out the task data */
selectedTasks: listOfTasks[indicies],
/* Return the task IDs */
selectedTasks.taskId
)
当然可以用更少的仪式来拼写:
listOfTasks[wherecontains("LIFE_MAX_DAYS", listOfTasks.taskCode)].taskId
推荐阅读
- sql - 如何使用“in”运算符返回 0 而不是 null
- mongodb - Mongo URI 问题 - SSL 对等证书验证失败:自签名证书
- typescript - 在 Typscript 可区分联合中省略整个类型
- python - IP 捕获或主机名的正则表达式
- python - 如何计算python函数的执行时间?
- c++ - 使用 cmake 进行墨西哥
- javascript - querySelector 似乎正在从输入 id="submit" 和另一个输入 type="submit" 中识别“#submit”
- python - 如何使用 Python 停止/删除 GCP Compute 实例
- python - 所选值的总最大值
- swift - 在 Swift 中为 UIButton 的文本添加基本的发光效果