Skip to Content
author's profile photo Former Member
Former Member

What can I do to easily update an item (without having to mention each instance individually)?

  • 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 :

  1. in items.xml, when I define the new property, if I use em().getEnumerationValue("NewProperty","someValue"), this will only apply to new instances

  2. 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

  3. 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
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 15, 2017 at 10:43 AM

    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    
    
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.