How to Update the value of xClasss xProperty by AML or API?

オフライン
Hi Eli, How to Update the value of  xClasss xProperty via API or AML? I can get the value of an xProperty  via MyItem.getProperty("xp-MyPropertyName") or AML. But I failed to update xProperty this way. Item MyItem = innovator.newItem("Part","edit"); MyItem.setID("xxxxxxxx"); MyItem.setProperty("xp-length","10"); MyItem.apply();   Lin    
  • Hi Lin, Code looks right. I usually look at the returned Item from MyItem.apply();
    MyItem = MyItem.apply();
    if ( MyItem.isError() )
    {
      // have a look at the error string or do something
    }
    This should give you some clues what is going wrong with the update. Cheers, Brian.
  • Hi Lin, If your xProperty is already defined, try setting the set attribute on the xProperty like this:
    Item MyItem = innovator.newItem("Part","edit");
    MyItem.setID("xxxxxxxx");
    MyItem.setProperty("xp-length","10");
    MyItem.setPropertyAttribute("xp-length","set","value");
    MyItem.apply();
    This code will result in AML like this:
    <Item type="Part" action="edit" id="xxxxxxxx">
       <xp-length set="value">10<xp-length/>
    </Item>
    Eli
    Eli Donahue Aras Labs Software Engineer
  • オフライン in reply to Eli Donahue

    Hi Eli,

    We added extended classifications to our PART itemtype after we had already established thousands of records for parts. How can I do a global update to all parts and set the "extended property value". I try to create a method to update parts , but it gives me an error "You tried to perform "update" operation against not defined Extended Properties". I'm assuming because the parts were created before we setup "extended classifications"