Custom attribute default value instead of None
1 1

3 posts in this topic

Hi,

I hope this issue is not caused because we don't have newest ftrack_api version and please let me know if we're handling with old issue.

Hierarchical custom attributes makes us unhappy at the moment. Api do not return `None` if default value is set which breaks everything with hierachical attributes for us.

Example:

Hierarchical Custom attribute `hier_attr` with default value `100` in hierarchy:

- project_xy - `hier_attr` is set to `50` / API will return `50`
-- hier_1   - `hier_attr` is set to `200` / API will return `200`
--- hier_1_1 - `hier_attr` is not set / API will return `100`

If value is not set, `None` should be returned (which is acceptable possibility), or `200` in this case and only if all parents don't have set that custom attribute's value then default should be returned like values in web app.

Second variant is better for us, but first one also make sence and meets the documentation. Is that possible?

Thanks,

Jakub Trllo

Share this post


Link to post
Share on other sites

HI @Jakub Trllo,  

>> I hope this issue is not caused because we don't have newest ftrack_api version
I've been checking this with the one of latest api (1.8.0), but I would expect the same behaviour from previous versions too.
If you suspect is an api version issue please let me know what version are you using so I can try to replicate.

>> Api do not return `None` if default value is set 
Setting the default value on the custom attribute indeed override the None if the value is not set, that's what is for.
>> If value is not set, `None` should be returned 
If you want it to return None, you simply have to leave the default value empty, tested now and seems to be working as expected.

>> [....] if all parents don't have set that custom attribute's value then default should be returned like values in web app.
On checking the previous hierarchy item, that's something I'd leave to the coder to implement as custom logic , rather than providing it by default (as it might cause confusion)

 

Hope it helps!
L.

Share this post


Link to post
Share on other sites

Hi,

>> If you want it to return None, you simply have to leave the default value empty, tested now and seems to be working as expected.

That's what we are recommending now but our clients mess it up sometimes.

>> Setting the default value on the custom attribute indeed override the None if the value is not set, that's what is for.

I expect the same `only` if it is not hierarchical attribute - hierarchical attributes should have different properties in API because they have different properties in web app and I don't want to get default value if any of parents value is set. Or better I want to get default value of hierarchical attribute only on project entity if do not have set it because that's top entity. On lower entities doesn't make sence return default value because may return nonsence data (like in example upwards).

Exist a way how to get information about custom attribute is set or not on entity? Special query or something? That's all I need at the moment...

Thanks,

Jakub

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1 1