get property list from item type, issue reading the result item

hello,

i want to get a list of names of propreties that start a certain way 'z%'. i've found aml that was supposed to do it, i' made an iom code to recrate that aml (actually creates the right aml). But what i get is only one item, so i want to know if the aml is actually good or if there is a specific way to get the properties from that one item i get.

<AML>
<Item action="get" type="itemType" select="name" where="ItemType.name = 'ZFCcontrainteTemplate'">
	<name>part</name>
	<Relationships>
		<Item type="property" action="get" select="value, label" where="[property].label like 'z%'" />
	</Relationships>
</Item>
</AML>

var FCitemType = inn.newItem("itemType", "get");
// FCitemType.setProperty("name","FCcontrainteTemplate");
// FCitemType.setAttribute("select", "name");
FCitemType.setAttribute("where", "[itemType].name like 'ZFCcontrainteTemplate'");


var property = FCitemType.createRelationship("property", "get");
property.setAttribute("select", "label");
property.setAttribute("where", "[property].label like 'z%'");

console.log("FCitemType before apply: "+FCitemType.ToString());
FCitemType = FCitemType.apply();

thanks

lucas

Parents
  • Your result contains items of two ItemTypes. The parent itemtype (1 item) and the sub-itemtype (many items).

    Try to filter your result with xpath:

    Item myprops = yourresult.getItemsByXPath("//Item[@type='Property']");

    You can throw a log entry with the amount of properties by using myprops.getItemCount();

    And maybe use PropertyCondition instead of "Where" to apply the filter. Is more secure according to Aras:

    Item myParts= this.newItem("Part", "get");
    myParts.setAttribute("select", "item_number");
    myParts.setPropertyCondition("item_number", "like");
    myParts.setProperty("item_number", "C123%");

  • I've tried to get the properties objects using x path as you mentionned but i get an ItemCount = 0

    i do have some properties stating with z in my item type, if you have any idea why that doesn't work let me know,

    and i couldn't apply the filter through propertycondition without getting an error 

  • Is your Method JS or C#? and I am not sure, if ItemTypes names are case sensitive. Does it work better when you write them like in the database? 

  • in my db the property labels are null i thought  that was the source of my problems, but filtering on name instead of label for properties didn't solve my issue , the x path result item still as an item count of 0 but when i do a .toString on the x path result it looks like al the properties i want are here, anay suggestions ?

    my xpathresult.ToString() :

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="">schemas.xmlsoap.org/.../"><SOAP-ENV:Body><Result><Item type="ItemType" typeId="450906E86E304F55A34B3C0D65C097EA" id="808DE75E6CED432C9A1CA4BF4F421920"><allow_private_permission>1</allow_private_permission><auto_search>0</auto_search><config_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</config_id><core>0</core><created_by_id keyed_name="Innovator Admin" type="User">30B991F927274FA3829655F50C99472E</created_by_id><created_on>2021-07-29T10:37:16</created_on><enforce_discovery>1</enforce_discovery><generation>1</generation><hide_where_used>0</hide_where_used><id keyed_name="ZFCcontrainteTemplate" type="ItemType">808DE75E6CED432C9A1CA4BF4F421920</id><implementation_type>table</implementation_type><instance_data>ZFCCONTRAINTETEMPLATE</instance_data><is_current>1</is_current><is_dependent>0</is_dependent><is_relationship>0</is_relationship><is_released>0</is_released><is_versionable>0</is_versionable><keyed_name>ZFCcontrainteTemplate</keyed_name><large_icon>../Images/Columns.svg</large_icon><major_rev>A</major_rev><modified_by_id keyed_name="Innovator Admin" type="User">30B991F927274FA3829655F50C99472E</modified_by_id><modified_on>2021-08-03T11:54:24</modified_on><new_version>1</new_version><not_lockable>0</not_lockable><open_icon>../Images/Columns.svg</open_icon><permission_id keyed_name="ItemType" type="Permission" origPermission="102D29B8CD9948BFB5F558341DF4C0F9">102D29B8CD9948BFB5F558341DF4C0F9</permission_id><revisions keyed_name="Default" type="Revision">7FE395DD8B9F4E1090756A34B733D75E</revisions><show_parameters_tab>1</show_parameters_tab><structure_view>tabs off</structure_view><unlock_on_logout>0</unlock_on_logout><use_src_access>0</use_src_access><name>ZFCcontrainteTemplate</name><Relationships><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="2A7AF9C5C6A54595AB52DEA800B0AAFA"><id keyed_name="zboitier" type="Property">2A7AF9C5C6A54595AB52DEA800B0AAFA</id><source_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</source_id><name>zboitier</name></Item><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="F573A021636741979487FE3D5B986BF3"><id keyed_name="zboitier_bool" type="Property">F573A021636741979487FE3D5B986BF3</id><source_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</source_id><name>zboitier_bool</name></Item><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="C57D586BC997468B907C272401AC8E5A"><id keyed_name="zboitier_operator" type="Property">C57D586BC997468B907C272401AC8E5A</id><source_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</source_id><name>zboitier_operator</name></Item><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="CB06C9E538E743DF85AC078AD83D439B"><id keyed_name="zrohs_capa" type="Property">CB06C9E538E743DF85AC078AD83D439B</id><source_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</source_id><name>zrohs_capa</name></Item><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="8F47F8B9D56240569BBC7EDE60603A58"><id keyed_name="zrohs_capa_bool" type="Property">8F47F8B9D56240569BBC7EDE60603A58</id><source_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</source_id><name>zrohs_capa_bool</name></Item><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="117A7334FA4748F0948476F3F17CEC21"><id keyed_name="zrohs_capa_operator"

Reply
  • in my db the property labels are null i thought  that was the source of my problems, but filtering on name instead of label for properties didn't solve my issue , the x path result item still as an item count of 0 but when i do a .toString on the x path result it looks like al the properties i want are here, anay suggestions ?

    my xpathresult.ToString() :

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="">schemas.xmlsoap.org/.../"><SOAP-ENV:Body><Result><Item type="ItemType" typeId="450906E86E304F55A34B3C0D65C097EA" id="808DE75E6CED432C9A1CA4BF4F421920"><allow_private_permission>1</allow_private_permission><auto_search>0</auto_search><config_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</config_id><core>0</core><created_by_id keyed_name="Innovator Admin" type="User">30B991F927274FA3829655F50C99472E</created_by_id><created_on>2021-07-29T10:37:16</created_on><enforce_discovery>1</enforce_discovery><generation>1</generation><hide_where_used>0</hide_where_used><id keyed_name="ZFCcontrainteTemplate" type="ItemType">808DE75E6CED432C9A1CA4BF4F421920</id><implementation_type>table</implementation_type><instance_data>ZFCCONTRAINTETEMPLATE</instance_data><is_current>1</is_current><is_dependent>0</is_dependent><is_relationship>0</is_relationship><is_released>0</is_released><is_versionable>0</is_versionable><keyed_name>ZFCcontrainteTemplate</keyed_name><large_icon>../Images/Columns.svg</large_icon><major_rev>A</major_rev><modified_by_id keyed_name="Innovator Admin" type="User">30B991F927274FA3829655F50C99472E</modified_by_id><modified_on>2021-08-03T11:54:24</modified_on><new_version>1</new_version><not_lockable>0</not_lockable><open_icon>../Images/Columns.svg</open_icon><permission_id keyed_name="ItemType" type="Permission" origPermission="102D29B8CD9948BFB5F558341DF4C0F9">102D29B8CD9948BFB5F558341DF4C0F9</permission_id><revisions keyed_name="Default" type="Revision">7FE395DD8B9F4E1090756A34B733D75E</revisions><show_parameters_tab>1</show_parameters_tab><structure_view>tabs off</structure_view><unlock_on_logout>0</unlock_on_logout><use_src_access>0</use_src_access><name>ZFCcontrainteTemplate</name><Relationships><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="2A7AF9C5C6A54595AB52DEA800B0AAFA"><id keyed_name="zboitier" type="Property">2A7AF9C5C6A54595AB52DEA800B0AAFA</id><source_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</source_id><name>zboitier</name></Item><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="F573A021636741979487FE3D5B986BF3"><id keyed_name="zboitier_bool" type="Property">F573A021636741979487FE3D5B986BF3</id><source_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</source_id><name>zboitier_bool</name></Item><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="C57D586BC997468B907C272401AC8E5A"><id keyed_name="zboitier_operator" type="Property">C57D586BC997468B907C272401AC8E5A</id><source_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</source_id><name>zboitier_operator</name></Item><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="CB06C9E538E743DF85AC078AD83D439B"><id keyed_name="zrohs_capa" type="Property">CB06C9E538E743DF85AC078AD83D439B</id><source_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</source_id><name>zrohs_capa</name></Item><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="8F47F8B9D56240569BBC7EDE60603A58"><id keyed_name="zrohs_capa_bool" type="Property">8F47F8B9D56240569BBC7EDE60603A58</id><source_id keyed_name="ZFCcontrainteTemplate" type="ItemType" name="ZFCcontrainteTemplate">808DE75E6CED432C9A1CA4BF4F421920</source_id><name>zrohs_capa_bool</name></Item><Item type="Property" typeId="26D7CD4E033242148E2724D3D054B4D3" id="117A7334FA4748F0948476F3F17CEC21"><id keyed_name="zrohs_capa_operator"

Children