【问题标题】:find associated values in dictionary在字典中查找关联值
【发布时间】:2020-07-17 04:53:04
【问题描述】:

我有一个条件,我需要获取任务代码为“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

【问题讨论】:

    标签: appian


    【解决方案1】:
    • 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-09
      • 2019-12-23
      • 1970-01-01
      • 2022-07-05
      • 2019-05-05
      • 2017-06-12
      • 2010-11-19
      • 1970-01-01
      相关资源
      最近更新 更多