Generating a dynamic String output using a DMN table

My usecase is generating a dynamic output based on the input of the DMN.

Eg: Say i have a variable assignedUser = “testuser1”, assignedGroup = “testGroup1”,
Rule in DMN is
if input == “USER”, output should be {“payload”:{“user”:${assignedUser}}}
& if input == “GROUP”, output should be {“payload”:{“group”:${assignedGroup}}}

But the CDATA inside the DMN xml is not able to parse it.

Any help ?

Hi.

You could create a DMN table where you have 2 outputs. One that sets payload.user and one that sets payload.group. And 2 rules that evaluate the input variable.
Something like this;

<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" id="definition_bc13cf10-39b2-11ed-80ab-0242ac110002" name="jsontable" namespace="http://www.flowable.org/dmn" exporter="Flowable Open Source Modeler" exporterVersion="6.7.2">
  <decision id="jsontable" name="jsontable">
    <decisionTable id="decisionTable_aeb60bd5-5982-4483-b8e0-d81c861f4bc8" hitPolicy="UNIQUE">
      <input>
        <inputExpression id="inputExpression_b469466d-fd52-4fa6-a767-225ccd2cd700" typeRef="string">
          <text>input</text>
        </inputExpression>
      </input>
      <output id="outputExpression_e61b6846-21a2-4952-ad07-6bef71d064c5" name="payload.user" typeRef="string"></output>
      <output id="outputExpression_822aa219-07bd-4605-a211-2008bc6d5808" name="payload.group" typeRef="string"></output>
      <rule>
        <inputEntry id="inputEntry_b469466d-fd52-4fa6-a767-225ccd2cd700_1">
          <text><![CDATA[== "user"]]></text>
        </inputEntry>
        <outputEntry id="outputEntry_e61b6846-21a2-4952-ad07-6bef71d064c5_1">
          <text><![CDATA[${assignedUser}]]></text>
        </outputEntry>
        <outputEntry id="outputEntry_822aa219-07bd-4605-a211-2008bc6d5808_1"></outputEntry>
      </rule>
      <rule>
        <inputEntry id="inputEntry_b469466d-fd52-4fa6-a767-225ccd2cd700_2">
          <text><![CDATA[== "group"]]></text>
        </inputEntry>
        <outputEntry id="outputEntry_e61b6846-21a2-4952-ad07-6bef71d064c5_2">
          <text><![CDATA[""]]></text>
        </outputEntry>
        <outputEntry id="outputEntry_822aa219-07bd-4605-a211-2008bc6d5808_2">
          <text><![CDATA[${assignedGroup}]]></text>
        </outputEntry>
      </rule>
    </decisionTable>
  </decision>
  <dmndi:DMNDI></dmndi:DMNDI>
</definitions>

Hope this helps.

Regards,

Yvo

Do you have flowable source learning materials,