Cancel
Showing results for 
Search instead for 
Did you mean: 

Sorter

Valued Contributor
Valued Contributor

Hello,

can i use 2 different atributes (format datatype and integer) to sort in sorter? 

I need sort MU  this way in sorter                       sort("Integer","datatype","up")

3 REPLIES

Re: Sorter

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
in this case you can use a method for sorting, the method is called for each part and you calculate and return a real value for each part, the sorter finally uses these values to sort the MUs
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Sorter

You can also try to add up your two attributes in one user defined attribute: the primary sort criteria is the "high" value and the secondary the "low" one (I assumed, that your secondary value is of type "datetime").

Something like:

var prio1 := @.Prio
var prio2 := @.DemandDateTime

var prio1scaled := 1000 * prio1
var prio2scaled := log10(prio2 - str_to_datetime("1.1.1970 0:00:00")) 

@.CombinedPrio := prio1scaled + prio2scaled

That user defined attribute "CombinedPrio" you can use as your sort criteria and set it in control before the part enters the sorter.

 

PS: It can be tricky to find a good sum of the two values. Dependent on the range of your values, you perhaps have to adjust the 1000 * and the log10() in the code.

Re: Sorter

Valued Contributor
Valued Contributor

Hello, thank you for your posts. I used a similar solution as Anreas_SimPlan wrote.