Does DMN support Excel ranking function and Priority

For example, we have 10 input fields. we need to set priority for each input field. How do we implement in DMN. The input feed to DMN engine would be array of list. I am not finding any option in FEEL function.

In Excel, there is a feature called, ranking. but i am not finding similar function available in DMN. how do we map the same function in DMN.

In the DMN specification there is a priority defined only for output fields. For input items there’s no such thing.

Thanks for your reply. Even in output i am not finding an option to set priority for output field.

@cpbpm please share your example and how it should work. I don’t know this Excel function and how it is used. I think it is valuable to share more details :slight_smile:

Priority is defined as HitPolicy in DMN spec but currently not supported by Camunda:

Thank you McAlm. I see that Hit Policy: Priority is not supported as of 7.12. But in higher version, does this is fixed? I am not finding any reference which states that either supported or not supported.

@Philipp_Ossler, Thank you for your response. In excel there is a function called rank, which is basically sort all the values, based on the value, it will apply ranking values.

Our requirement is basically apply the priority and apply ranking so that highest ranking will be applied.

For example

we have 3 input fields Field A, Field B, Field C, we need apply priority for Field A and ranking. In second iteration we need to choose field B, in third iteration field C. Finally we need to retrieve the row which contains ranking 1 as final output.

Please do let me know if you need more info.

Hi,

Not perfect, but if you wanted to simulate something like the rank function, you could try some FEEL such as;

index of(sort(distinct values(list)),item)

Thus given a list and a value, this would return the rank (note that this does not treat duplicates the same as the Excel function)

Rather than a DMN table, you could consider a literal function…

Note its not quite clear to me whether you are trying to apply rank within an input column or across many input columns…

regards

Rob

@Webcyberrob,

Thanks for your reply. I am trying to apply ranking for multiple input columns.

Hi,

Im still a little puzzled…

In DMN, columns tend to represent ‘AND’, hence for a given row (rule), if there are values in columns A,B,C, the rule is interpreted as If A=x and B=y and C=z then…

Hence, when you say you want to apply ranking across columns, how exactly do you expect this to work? Can you provide a small contrived example?

regards

Rob

@Webcyberrob,

Thank you. I am interested only the top ranking for each column.

Field A Field B Field C
Custom Feel function which is list Custom Feel function which is list Custom Feel function which is list

Each column will have one ranking, I am thinking of selecting rank 1 from each column and produce the output.

I am thinking of producing two decisions, one will be for defining priority and that is passed as input to next decision to derive ranking.

Thank you once again for providing insights.

Hi,
so are you saying the input to columns A,B and C is a list of values for each column or, re you passing in a single value to each column and you want to map these values from their absolute value to their relative values (rank) across the set?

Alternatively, perhaps for each column A,B,C you have a static list of values and when you pass in a variable for a column you want to translate it to its rank according to the columns defined set?

I still dont quite follow what you are trying to achieve…

regards

Rob