on 12-15-2017 10:36 AM
Given an item that already has many instances in the database
When I add a new property to this item
I want to have default value (for the new property) for all existing instances
Now, the problems :
in items.xml, when I define the new property, if I use em().getEnumerationValue("NewProperty","someValue"), this will only apply to new instances
in an impex, when I try to update, if I do not include an unique property in the update, it will fail saying that I need a property that is unique
in an impex, when I try to update, if I include an unique property in the update, but I leave the value empty , it will fail saying that the property that is unique needs to have a value
But I want to update all existing instances with a default value for the new property, without having to specify a line in the impex for all unique ids of this item. I already have many instances of this item and I do not want to collect all the values of the unique column to put them in my impex.
What can I do to easily update (without having to mention each instance individually) ?
UPDATE MyItem;id[unique=true];newProperty
; ;someDefaultValue
You can use batch mode to update all instances of item type. In below example I updated availability of all stock levels in system with value 150
Update StockLevel[batchmode=true];itemtype(code)[unique=true];available
;StockLevel;150
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.