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 - Problem in values client

tigrao - Thursday, January 20, 2011 11:11 AM:

Hello everyone!

I've got a problem opening a form.
I have 3 ItemType: ItemA,  ItemB and ItemC.

The ItemA is related ItemB, and the ItemB is related to  ItemC.

In the ItemA Form I have an HTML field that I want to display
a plot involving the values of the two remaining items.
here is part of the code:

var text = "<table> <tr>";
var itemGrafico = document.thisItem;
var returnItemB = itemGrafico.getItemsByXpath("Relationships / Item / related_id / Item [@ type = 'ItemB']");

for (var i = 0; i <returnItemB.getItemCount (); i + +) {
    var company = returnItemB.getItemByIndex (i);
    text + = "<td>" + company.getProperty ("name ")+"</ td> ";
}

for (var i = 0; i <returnItemB.getItemCount (); i + +) {
    var Company2 = returnItemB.getItemByIndex (i);
   var resp = company2.getRelationships ("ItemB ItemC ");

    for (var c = 0, c <resp.getItemCount (); c + +) {
       var cat = resp.getItemByIndex (c);
       text + = "<tr> <td>"+ cat.getRelatedItem(). getProperty ("name") + "</ td> </ tr> ";
    }
}
text +="</ tr> </ table> ";


And certainly there are item related ItemB  and ItemB related ItemC.
However when I run the method resp.getItemCount () value is 0 (zero).

And when I run the AML nash.aspx are displayed 2 values unlike the above.

I thank the help!



Brian - Friday, January 21, 2011 7:10 AM:

Hi Tigrao,

First question I have is are you sure that "document.thisItem" contains all of the information that you are looking for? Have you had a look at the contents in the debugger?

Have you tried retrieving the relationships directly instead of getting them out of "document.thisItem"? You should be able to use the same AML that you are using in the NASH script to build the query inside the HTML field. That way you know that you are comparing the same things.

Is the "getItemsByXpath(......) syntax correct? I know that I sometimes struggle with this. You are starting with "Relationships/" is there anything in the document before this "*/*/*/Item/Relationships....."?

Hope this helps.

Cheers,

Brian.



tigrao - Wednesday, January 26, 2011 6:23 AM:

Hi friends,

I've debugged and the syntax is correct.

only when I try to run the query does not return values, and I looked in the manuals as directed but still is not getting result.