0

I am a newbie in dmn and i have a requirement as below

Sample input:
Input:{
Person: P1
Transaction:{
Transaction Id: 1
Event:{
Event name: "gate opened",
Event value: "yes"
},
Event:{
Event name: "atm operative",
Event value: "yes"
},
Event:{
Event name: "open date",
Event value: "2022-07-28"
}
},
Transaction:{
Transaction Id: 2
Event:{
Event name: "gate opened",
Event value: "yes"
},
Event:{
Event name: "atm operative",
Event value: "yes"
},
Event:{
Event name: "open date",
Event value: "2022-07-29"
}
},
Transaction:{
Transaction Id: 3
Event:{
Event name: "transaction done"
Event value: "yes"
},
Event:{
Event name: "amount value",
Event value: "100"
},
Event:{
Event name: "open date",
Event value: "2022-07-29"
}
}
}

To describe i will have one person data who can perform multiple transactions everyday having multiple events under each transaction. There is no specific count for either events or transactions.
My task is to group the events by event name when its "gate opened" and get the min(open date) and max(open date) and assign a unique number for all the matching transaction
If there are no matching transaction i need to use the date to be both min and Max open date and assign another unique number to it

So output should look like below Output:
{Person: P1
Unique data:
{Unique Id: 1,
Mindate:"2022-07-28",
Maxdate:"2022-07-29"
}
Unique data:
{Unique Id: 2,
Mindate:"2022-07-29",
Maxdate:"2022-07-29"
}
}

I tried to flatten at transaction level and flatten event level for each transaction. I am unable to compare event name from one transaction to another transaction (group by the event name). I need help in understanding how can I check it running in a loop.

Thanks in advance!!

  • In the output, would you expect to be also `Unique data: {Unique Id: 3, Mindate: "2022-07-29", Maxdate: "2022-07-29"}` ? – tarilabs Jul 29 '22 at 06:08
  • Also, for the **Unique Id 1** in your output please clarify why `Maxdate:"2022-07-29"`... I would have expected Maxdate to be the 28, since under transaction 1 the only "open date" is about `Event:{ Event name: "open date", Event value: "2022-07-28" }` – tarilabs Jul 29 '22 at 06:09
  • Well, i would like to group the records based on "open gate" and calculate the min and Max open date and assign a unique Id to it. For other transactions where open gate is note present, i want them to be in another unique id.Since transaction 3 doesn't have "open gate" I would like it to be under another unique id. – Harikrishnamv Jul 29 '22 at 10:43

0 Answers0