photools.com Community

IMatch Bug Reports and Feature Requests => Feature Requests => Archive (Feature Requests) => Topic started by: ubacher on July 15, 2017, 03:47:47 PM

Title: scripting: setting attributes: make op "update" work like "add" if not existing
Post by: ubacher on July 15, 2017, 03:47:47 PM
When writing an attribute to a file one has to read the attribute first in order to decide if one has to use
the op: 'add' or the op: 'update'.

Making the op: 'update' work like 'add' when an attribute does not exist would simplify code a lot.
(saves one additional async call per setting)
Title: Re: scripting: setting attributes: make op "update" work like "add" if not existing
Post by: Mario on July 15, 2017, 06:44:01 PM
update exists to update an existing instance. You need to provide the instance if to update, which means you need to determine it in advance. And if you cannot determine the instance id in advance, there is no need (or way) to call update. Just call add when you want to add a new record.
Title: Re: scripting: setting attributes: make op "update" work like "add" if not existing
Post by: ubacher on July 16, 2017, 05:23:55 PM
I only allow one instance. Thus I want to update (or add) instance
Title: Re: scripting: setting attributes: make op "update" work like "add" if not existing
Post by: Mario on July 16, 2017, 06:18:48 PM
I don't make assumptions usually about what is common or not.
It is easy and fast to determine if and how many Attribute records a file has and then whether to update existing records or add new ones.