Pull one entry with largest field value from any partition in a list

Pull one entry with largest field value from any partition in a list

chao_gao1
Not applicable
4 Views
4 Replies
Message 1 of 5

Pull one entry with largest field value from any partition in a list

chao_gao1
Not applicable

[ FlexSim 17.0.2 ]

If I have a list that's already partitioned due to other needs, then later in the process, I want to pull one entry out of the list that has the largest filed value of "Seq_Num", I don't care which partition it is from, just want to pull the entry that has the largest field value, how would I be able to achieve this?

The command listpull is not working in this case, as i have to specify the partition ID or make that 0, if I make that 0, it's going to treat 0 as the partition ID, not trying to pull from any partition IDs.

Thanks,

Chao

0 Likes
Accepted solutions (1)
5 Views
4 Replies
Replies (4)
Message 2 of 5

jeff_nordgren
Not applicable

@Chao Gao,

It appears that in the lispull command that partiionid and flags (last possible two parameters) are optional. What happens if you just put in the listpull - list,query,requestNum and requireNum and don't put in the partionId or the flags options?

0 Likes
Message 3 of 5

Matthew_Gillespie
Autodesk
Autodesk

If you don't specify a partition Id it will use the default null partition. This is the same as entering 0.



Matthew Gillespie
FlexSim Software Developer

0 Likes
Message 4 of 5

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

Currently there isn't a way to pull from multiple partitions at once.

The best solution I've found for this is to use a flat list with two fields: one that represents the partition and then Seq_Num. To pull from a specific partition you use a Where clause:

WHERE partition = 3

Pulling the highest Seq_Num regardless of partition is now a simple ORDER BY:

ORDER BY Seq_Num

Another way to deal with this is to pull multiple times. You can pull without actually pulling anything off just to query the list. Query the different partitions and then decide which one to pull from. I would recommend the first approach though.



Matthew Gillespie
FlexSim Software Developer

Message 5 of 5

jeff_nordgren
Not applicable

Good to know.

0 Likes