简体   繁体   English

AWS Step Functions - 选择

[英]AWS Step Functions - Choice

Given this input (which is output from a previous map task):给定此输入(这是先前地图任务的输出):

[
  {
    "result": {
      "validated": true,
      "order": "1"
    }
  },
  {
    "result": {
      "validated": true,
      "order": "2"
    }
  }
]

how do I access the validated flag in a choice task.如何在选择任务中访问经过验证的标志。 I would have thought it is:我会认为它是:

"Choice": {
  "Type": "Choice",
  "Choices": [
    {
      "Variable": "$.result[0].validated",
      "BooleanEquals": true,
      "Next": "Success"
    }
  ],

but that doesn't work - I get "Invalid path '$.result[0].validated': The choice state's condition path references an invalid value".但这不起作用 - 我得到“无效路径'$.result[0].validated':选择状态的条件路径引用无效值”。

Also I will never know how many 'results' will be in that array (produced by the map task).此外,我永远不会知道该数组中将有多少“结果”(由 map 任务生成)。 How can I process the 'validated' flag to check that they are all true?我如何处理“已验证”标志以检查它们是否全部为真? Any suggestions welcome!欢迎任何建议!

hi with the given input it is evident that '$.result[0].validated' will be invalid as '$' represents the root of the input and you are accessing 'result' on the root which does not exist.您好,对于给定的输入,很明显 '$.result[0].validated' 将无效,因为 '$' 代表输入的根,而您正在访问不存在的根上的 'result'。 '$[0].result.validated' should work instead. '$[0].result.validated' 应该可以代替。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM