Re: [Maya-Python] Check and grab the latest value of a certain condition using dictionary

2017-07-10 Thread Justin Israel
On Tue, Jul 11, 2017 at 1:52 PM Alok Gandhi wrote: > If you consider creating the model data dict having status as the keys > then the whole search becomes increasingly simple: > True. Although imagine that the model data is likely to have more fields than just a

Re: [Maya-Python] Check and grab the latest value of a certain condition using dictionary

2017-07-10 Thread Alok Gandhi
If you consider creating the model data dict having status as the keys then the whole search becomes increasingly simple: # Force an order for status search STATUS_SEARCH_ORDER = ('Approved', 'In Progress', 'Pending', 'In Use') def get_model(model_data): model = None model_status = None

Re: [Maya-Python] Check and grab the latest value of a certain condition using dictionary

2017-07-10 Thread Justin Israel
Hey, Check out these two approaches: https://repl.it/JViC/1 The overall approach is to have a custom comparison function so that you can sort you model dict by status and then by name. We would want our subset of statuses that are "available" to come first, followed by a secondary sorting of the

[Maya-Python] Check and grab the latest value of a certain condition using dictionary

2017-07-10 Thread likage
I have created a dictionary in which it stores the information as follows: dict = {'model_v001': 'In Progress', 'model_v002': 'In Use', 'model_v003': 'In Progress', 'model_v004': 'In Progress', 'model_v005': 'Approved', 'model_v006': 'Pending'} I am trying to achieve that, from the