This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - How to iterate over all visible item properties?

flo - Wednesday, January 20, 2016 11:16 AM:

How can I iterate over all item properties that have hidden and hidden2 set to false in a server-side C# method to retrieve the properties names? I am using Aras Innovator 11.0 Build Build 6073.



tstickel - Friday, January 22, 2016 10:13 AM:

Here's the AML to find properties having both hidden and hidden2 set to false for the Part itemtype.  In your C# method you will have to change the <name>Part</name> criteria to point to the itemtype you are interested in.  Your code can then apply this AML and iterate through the result.

<AML>

<Item type="itemtype" action="get" select="name">

<name>Part</name>

<Relationships>

<Item type="property" action="get" select="name,is_hidden,is_hidden2"

where="property.is_hidden = '0' and property.is_hidden2 = '0'">

</Item>

</Relationships>

</Item>

</AML>

 

 



flo - Monday, March 14, 2016 1:01 PM:

Thank you, this helped me to get started. Here is, how I solved the problem in a server-side C# method, assuming "this" is an item:

Innovator innovator = this.getInnovator();
Item properties = innovator.newItem("Property", "get");
properties.setAttribute("select", "name"); // optional
properties.setProperty("is_hidden", "0");
properties.setPropertyCondition("is_hidden", "eq");
properties.setProperty("is_hidden2", "0");
properties.setPropertyCondition("is_hidden2", "eq");
properties.setProperty("source_id", this.getAttribute("typeId"));
properties.setPropertyCondition("source_id", "eq");
properties = properties.apply();
string name;
Item property;
for (int i = 0; i < properties.getItemCount(); i++)
{
    property = properties.getItemByIndex(i);
    name = property.getProperty("name");
}