【问题标题】:Camunda: Test whether JSON array contains an elementCamunda:测试 JSON 数组是否包含元素
【发布时间】:2021-10-15 12:12:51
【问题描述】:

我希望条件流取决于 JSON 属性(包含 JSON 字符串数组)是否包含特定元素。

如果元素存在,则以下表达式有效,但如果不存在则抛出异常:

   <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
       ${ json_array.indexOf("foo")!=-1 } 
   </bpmn:conditionExpression>

尽管 the documentation 声称不应该发生这种情况 (issue 134),与 lastIndexOf() 的等效表达式也会失败。

还有其他方法吗?

【问题讨论】:

    标签: bpmn camunda camunda-spin


    【解决方案1】:

    这可行,但看起来相当笨重:

        <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
           ${ json_array.toString().contains("\"foo\"") } 
        </bpmn:conditionExpression>
    

    希望有更好的办法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-13
      • 2013-11-16
      • 2016-10-13
      相关资源
      最近更新 更多