Linkin fields without using daemon

Hi all,

I have a custom field that is simply meant to shot the status text of a shot so that I can use it in status reports without the clients wondering what the icons mean.
In a SG daemon I am trying to keep that fiels in sync with the shots’ native status field but unfortunatelt the deamon frame work has never been 100% reliable for me and it tends to crash and not update things as expected.

Is there any way to make this happen with a calculate field so I don’t have to rely on the daemon?

Cheers,
frank

god how thick I am sometimes. Nevermind, all it took was a calculated field with {sg_status_text} in it.
Solved

Gah, ignore the “solution”, I was referencing the very field I am trying to replace.
But I RTFMed so I think the solution is a lengthy IF construct combined with TO_CODE({sg_status_list}) to turn the status code into a proper string readable by clients

1 Like

So just to wrap up my little monologue for posterity, this is the sort of calculation I needed:
if(to_code({sg_status_list}) = "dlvr", "Delivered", if(to_code({sg_status_list}) = "ip", "In Progress", "to_code({sg_status_list})"))

etc.

Sooo, turns out the calculation field only taks a limited amount of characters, so when I try to expand on the above solution to include all used statuses the string is too long for the field.
So two questions spring to mind:
1 - if I do this via the api will it take any string, no matter how long?
2 - can’t the above solution be simplified to simply look up the full label of each status rather than manually having to check the code and translate it to the same string?

Cheers,
frank

2 Likes

+1 for 2…

1 Like

So it looks like using the API has the same limitation, and if a string is assigned that is too long the field will just error in SG.
E.g. if I assign one more if statment to the below spaghetti code it will break the field:

calc = """if(to_code({sg_status_list}) = "dlvr", "Delivered", if(to_code({sg_status_list}) = "ip", "In Progress", if(to_code({sg_status_list}) = "wtg", "Waiting To Start", if(to_code({sg_status_list}) = "omt", "Omit", if(to_code({sg_status_list}) = "hld", "On Hold", if(to_code({sg_status_list}) = "rdy", "Ready To Start", if(to_code({sg_status_list}) = "fin", "Final", to_code({sg_status_list}))))))))"""
properties = {"calculated_function": calc}
sg.schema_field_update("Shot", "sg_status_text", properties)

So, any clever ideas to dynamically look up the field name based on it’s code? Cause that would be nice and tidy.