Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • BeN01
    replied
    yep, can we talk about it by mail ?

    glevbe06@gmail.com

    thanks

    Leave a comment:


  • hgaglani
    replied
    Any particular error in the soln I posted??

    Leave a comment:


  • BeN01
    replied
    any help ?

    Leave a comment:


  • BeN01
    replied
    Isomorphic can you help me ?

    Leave a comment:


  • BeN01
    replied
    any suggestions ?

    Leave a comment:


  • BeN01
    replied
    then please explain me how ...
    The only thing i can obtain setting the valueXpath is "\n "
    I do it using getAttribute("recipientTo")

    the value Xpath i set :
    Code:
    recipientTo = new DataSourceTextField( "recipientTo", "recipientTo" );
    recipientTo.setValueXPath( "//response/data/records/message/recipientTo" );
    Pls help me

    (if i use a JavaScriptObject i throw an exception)

    thanks!

    Leave a comment:


  • Isomorphic
    replied
    Hi Hetal,

    As previously mentioned, your data has an extra <records> element that you need to get rid of if you are using RestDataSource.

    A properly formed XPath will return multiple values if the XPath is correct. If you think there's a SmartGWT problem here, the best thing to do is post a standalone test case so we can more quickly take a look at it and either correct your usage and identify a bug.

    Leave a comment:


  • hgaglani
    replied
    Originally posted by Isomorphic
    Using valueXPath will mean each record gets on recipientTo/Address. If there are multiple records each will have a Name and Address.
    What we are looking for is multiple elements in each record and not multiple records so basically in terms of XML.. another complexType element within a complexType element.

    Like Ben mentioned and like I had mentioned in my post, the Xpath recipientTo/Address just returns the first Address value from the whole object in case there are multiple address elements in each record.

    What solution I have posted works.. but I wanted to know if there is a direct solution to work with the Datasource (or XPath) for the sample XML shown to retrieve the multiple address elements from the recipientTo node.

    Thanks,
    Hetal
    Last edited by hgaglani; 6 Apr 2009, 07:46.

    Leave a comment:


  • hgaglani
    replied
    I had a similar issue. I solved it this way..

    The code to get it in a String[] :
    Code:
    ListGridRecord[] li = response.getData();
    JavaScriptObject jso = li[0].getAttributeAsJavaScriptObject( "recipientTo" );
    JsArray arr = jso.cast();
    
    String[] addressArr = new String[arr.length()];
    for(int i=0;i<arr.length();i++)
    {
    	addressArr[i] = JSOHelper.getAttribute(arr.get(i),"Address");
    }
    if u print addressArr.. u shud get all the values in there.

    Hope this helps.

    Cheers,
    Hetal
    Last edited by hgaglani; 6 Apr 2009, 07:29.

    Leave a comment:


  • BeN01
    replied
    Each record have one recipientTo that contains a lot of Adress and Name :
    Code:
    <response>
      <status>0</status>
      <startRow>0</startRow>
      <endRow>1</endRow>
      <totalRows>1</totalRows>
      <data>
        <records>
          <message>
            <subject></subject>
            <sentDate>2009-02-27 12:22:08.0 CET</sentDate>
            <size>3662</size>
            <from>fayssal161466979@free.fr</from>
            <recipientTo>
              <Address>glev4retbe12345706@gmail.com</Address>
              <Name>Ben</Name>
               <Address>glev4retbe12345706@gmail.com</Address>
              <Name>Ben</Name>
              <Address>glev4retbe12345706@gmail.com</Address>
              <Name>Ben</Name>
             <Address>bob@bob.bob</Address>
              <Name>Bob</Name>
            </recipientTo>
            <uid>474</uid>
            <folderURL>gvfdg</folderURL>
            <summary>dfsg</summary>
            <content>dsfg</content>
            <seen>true</seen>
            <gotAttachment>dfsg</gotAttachment>
          </message>
        </records>
      </data>
    </response>
    I just want to retrieve all the Name and Adress in a List or in a String[] ...

    Leave a comment:


  • Isomorphic
    replied
    Using valueXPath will mean each record gets on recipientTo/Address. If there are multiple records each will have a Name and Address.

    If this doesn't help, start over and post a much clearer explanation of the data you're working with and how exactly it needs to be displayed.

    Leave a comment:


  • BeN01
    replied
    any help ?

    Leave a comment:


  • BeN01
    replied
    I want all the recipientTo/Address, i can have more than 1 value and i dont know how to get them ...

    If i the valueXPath to recipientTo/Address or recipientTo/Name, my result is only the value of the first recipientTo.

    Leave a comment:


  • Isomorphic
    replied
    valueXPath is relative to the record. You want just recipientTo/address.

    You also have an extra tag, get rid of <records>.

    Leave a comment:


  • marcello.nuccio
    replied
    Originally posted by BeN01
    Code:
    <response>
      <startRow>0</startRow>
      <endRow>1</endRow>
      <totalRows>1</totalRows>
    Isn't it wrong? From smartclient documentation:
    DSResponse.totalRows: Total number of rows available from the server that match the current filter criteria, when using paged result fetching.

    endRow: End row of returned server results, when using paged result fetching.
    Note that startRow *and* endRow are zero-based - the first record is row zero.
    In your case:
    Code:
    endRow - startRow + 1 == 2 > totalRows

    Leave a comment:

Working...
X