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 - Handle a collection of Items in JaveScript returned by a Serverside method call

fli - Thursday, February 3, 2011 8:32 AM:

Hi,

 

In order to populate a grid with search results I have done a C# method which returns a collection of wanted Items

The C# method returns the following:

<Result>
<Item type="MAN_Part" typeId="1B1D815590534400B4306B8B9219AA99" id="F71D7FD29D3840B1B0248FA3A48F34BE">
<is_released>0</is_released>
<_augsburg_part_id/>
<_material_alternative/>
<id keyed_name="EN150Y00304472 PREC.STEEL PIPES W.CERT." type="MAN_Part">F71D7FD29D3840B1B0248FA3A48F34BE</id>
<major_rev>1</major_rev>
<tc_rev>0</tc_rev>
<_external_standards/>
<_revision_change/>
<_material>S12R</_material>
<keyed_name>EN150Y00304472 PREC.STEEL PIPES W.CERT.</keyed_name>
<_unit_of_measure/>
<classification>/MAN_Part/Std Part</classification>
<_predecessor/>
<_usability/>
<generation>2</generation>
<modified_by_id keyed_name="Christoffer" type="User">6070188C1EC04331A282A4FDCC72C7CE</modified_by_id>
<new_version>0</new_version>
<not_lockable>0</not_lockable>
<created_by_id keyed_name="Innovator Admin" type="User">30B991F927274FA3829655F50C99472E</created_by_id>
<_component/>
<_group/>
<_remarks/>
<permission_id keyed_name="Administrators" type="Permission">5BE54C871FB14F6EBC11596D1A010D26</permission_id>
<_change_item_no/>
<_released_by>JEK</_released_by>
<created_on>2011-01-08T16:02:03</created_on>
<config_id keyed_name="EN150Y00304472 PREC.STEEL PIPES W.CERT." type="MAN_Part">0000C8180C3441208BE26EF7664A27F7</config_id>
<_successor/>
<is_current>1</is_current>
<modified_on>2011-02-02T15:53:34</modified_on>
<_spare_part/>
<_mass>10.241</_mass>
<productid>EN150Y00304472</productid>
<name>PREC.STEEL PIPES W.CERT.</name>
</Item>
<Item type="MAN_DesignSpec" typeId="3D57F9F54F1346929678C2F297810E20" id="F7FB2456860545F686707C696DC61505">
<classification/>
<created_by_id keyed_name="graham" type="User">2BC4EBC765AB400F8A546D37761AA545</created_by_id>
<_plant_type/>
<modified_on>2011-01-11T10:43:00</modified_on>
<generation>1</generation>
<_design_update_desc/>
<config_id keyed_name="4200845-1 7S80MC6,HSDENG" type="MAN_DesignSpec">F7FB2456860545F686707C696DC61505</config_id>
<_our_ref>LLS/SAG, case 73429-2008</_our_ref>
<permission_id keyed_name="Administrators" type="Permission">5BE54C871FB14F6EBC11596D1A010D26</permission_id>
<not_lockable>0</not_lockable>
<keyed_name>4200845-1 7S80MC6,HSDENG</keyed_name>
<is_current>1</is_current>
<_order_date>2008-10-27T11:27:21</_order_date>
<_project_remarks/>
<id keyed_name="4200845-1 7S80MC6,HSDENG" type="MAN_DesignSpec">F7FB2456860545F686707C696DC61505</id>
<_spec_archive_date>2010-10-27T11:27:21</_spec_archive_date>
<tc_rev>14</tc_rev>
<major_rev>1</major_rev>
<_based_on_design_spec/>
<_product_type>S80MC6</_product_type>
<new_version>0</new_version>
<modified_by_id keyed_name="graham" type="User">2BC4EBC765AB400F8A546D37761AA545</modified_by_id>
<_customer_id>DOOSAN</_customer_id>
<_cylinder_no>7</_cylinder_no>
<_eq_key/>
<_product_group>2 Stroke Engine</_product_group>
<created_on>2011-01-11T10:43:00</created_on>
<_your_ref>JS-0810-1009/HJB of 081024</_your_ref>
<_yard_name/>
<_build_no/>
<_dso_no/>
<_project_id/>
<is_released>0</is_released>
<_plant_name/>
<productid>4200845-1</productid>
<name>7S80MC6,HSDENG</name>
</Item>
</Result>

 I am able to load this to a Var, and write the Var to the screen in an alert.

When I try to .getItemByIndex(x) I get fault that: I am out of bounds of the array.  for every x

When I try to .getProperty("name","")  I get fault : not a single Item

  

I have tried a lot different approaches.  Please help

BR/ Christoffer



SamsAn - Thursday, February 17, 2011 3:21 PM:

Hi.

Try .loadAML("<AML><Item>...</Item></AML>") at client-side. I suspect you are using code like .loadAML("<Result><Item>...</Item></Result>").

SamsAn.