is it possible to create am DMN-Table that will return a “best-match” ?
This is going to be used for a inventory/stock system. We want to determine which attributes are required when taking stock
Let’s say we have 3 string input variables (Class,Function, Type) and 3 boolean output variables (serialRequired, macRequired,specialRequired)
It looks like this
Just from looking at it it works, but none of the hit policies (supported by camunda engine) seems to be working. Priority would be my best guess, but that is not available.
As you can see, the output variables do not add up. It is not like “For type chassis i just need the serial, if it is a chassis with funtion switch add the mac address, and if it is this special type also ask for the special attribute”
So i cant use the collect policy
So i tried “Rule order”. That returns a list of values per variable. As long as the order in the tble is correct i could pick the first (or last one)
you could consider a collect hit policy and a single output column. In other words, use a single out put which is effectively an enumerated type comprising the set of strings ‘MAC’, ‘Serial’, ‘Special’. Thus rather than return a fixed length (3) array of booleans, return a set of strings indicating what is required.
Now if your input conditions require 1,2 or 3 of the output conditions, create 1, 2 or 3 rows as appropriate. Thus the collect hit policy will match all relevant rows, and a list of conditions will be returned.
thanks for the idea. I fear it won’t worj in our use case. As long as the required attributes add up it works. But what if i need the MAC-Adresse for all Switches, but not for a certain type ? Due to the collect rule the MAC-Adresse would be added to the result in every case
It could be possible to add a second output “Attributes to ignore”, and have the ignored attributes removed by scripting.
In that case, couldnt you add an additional input variable called type. Hence the rule then becomes;
If (item == switch) and (type != excluded type) then Mac Address Required
you mean like this ?
The simulation works, but isn’t that too complex ? The “natural” way should be to define everything with one rule, Here i have to configure multiple rules. Imagine the case where there are 6 required attributes for Function Switch, in general but a certain type doesn’t require three of them, but additional two different attributes.
Instead of defining one rule, i would have to add 3 exclusions and 2 additions = 5 rules
We already have the Variable Type. I think with the if-clause it might get too complex. I would have to define
The idea was to define the specific type only if the required attributes differ from those “inherited” from either “function” or “class”. And differing means there could be additional fields required, or fields that are required on the “parent” should be removed.
Yes that sample DMN is what I mean. Thats the way to get the behaviour you want using the collect hit policy.