Forum Discussion

jamar's avatar
jamar
Ideator III
9 years ago

Get properties of an item number

Hello, I am in the process of creating an application (c#) that will display all / specific properties of a part number in the system. I have done a lot of searching but nothing seems to work. I'm a noobie to c# so might be doing it completely wrong. I essentially want to find the property "major_rev" of part 1000-00-0001 AML code that shows all properties <AML> <Item type="Part" action="get"> <item_number>1000-00-0001</item_number> </Item> </AML> Current c# code Innovator inn = IomFactory.CreateInnovator(conn); Item item = inn.newItem("Part", "get"); string mrev = item.getProperty("major_rev"); MessageBox.Show(mrev);  - this is blank

3 Replies

  • Hi Jamar, the following line just creates the query, it doesn't execute it
    Item item = inn.newItem(“Part”, “get”);
    you need to do item.apply(); before you read the property.
  • jamar's avatar
    jamar
    Ideator III
    Hello Yoann, Thanks for the speedy reply. I have updated the code which now looks like this, but only returns the part number. I feel there should be a getattributes() somewhere after string pro... Innovator inn = IomFactory.CreateInnovator(conn); string partnum = "1000-00-0001"; Item item = inn.newItem("Part", "get"); string pro = item.getProperty("major_rev", partnum); item.apply(); MessageBox.Show(pro);   Thanks James
  • the apply needs to be done before you actually read the returned property have you tried step by step debug to see what's happening?