How to get the position of the current row - InfoPath Dev
in

InfoPath Dev

How to get the position of the current row

Last post 08-21-2009 12:05 PM by kalyan@infopath. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 08-20-2009 11:58 AM

    How to get the position of the current row

    Hi all,

                I need to get the current row number using the "e.Site........" . Is this possible??  or else how to get the position of the current row in the changed event control of a repeating table.

     

    Thanks in advance,

    Kalyan.

    Filed under:
  • 08-20-2009 02:51 PM In reply to

    Re: How to get the position of the current row

     You should be able to use e.Site.Evaluate("count(preceding-sibling::repeatingFieldName)", NamespaceManager);

    This will return an object value that you can cast to a double, and after that, to an int if you want to.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-20-2009 03:45 PM In reply to

    Re: How to get the position of the current row

     Hi Jimmy,

     

    I tried that Convert.ToDouble(e. Site.Evaluate("count(preceding-sibling::LINE_NO)",NamespaceManager));

    Here LINE_NO is my repeating control Name. But it was getting "0.0" into that in each and every row of the table. I tried converting into int it was giving "0".

    I tried with e.Site.Select("../LINE_NO",NamespaceManager).CurrentPosition also. This was also giving the same value "0".

      By using e. Site.Evaluate("count(preceding-sibling::LINE_NO)",NamespaceManager); what you want me to  expect the result if i convert it into double and then into int. Is that the current row number????

  • 08-20-2009 05:37 PM In reply to

    Re: How to get the position of the current row

     Could you attach a screenshot of your data source?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-20-2009 07:06 PM In reply to

    Re: How to get the position of the current row

    Thanks for quick reply,

    Here is my data source.(Not the exact one, i am not supposed to show that,sorry for that). Here is the structure of my datasource,

    - myFields

      - queryFields

        - tns: Method1

           -  : Structure

              -  item (REPEATING NODE)

                            Field1

                            Field2 

                            Field3 

                            Field4 

                            LINE_NO (This is the control where i am writing my changed event and where i should get my row number) 

                            Field6 

                            Field7 

                            Field8 

                            Field9 

      - dataFields

          - tns: Method 2

                          retrieve Data

     

    This is the structure of my datasource Jimmy, Can you please help on how to get the current row number using  "e.Site".

    Thanks in Advance,

    Kalyan.

  • 08-20-2009 11:02 PM In reply to

    Re: How to get the position of the current row

     Please try Convert.ToDouble(e. Site.Evaluate("count(../preceding-sibling::item)",NamespaceManager));

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-21-2009 12:05 PM In reply to

    Re: How to get the position of the current row

    Hi Jimmy,

                It worked this time, thank you very much for your sugession.

     

    Thanks,

    Kalyan. 

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.