Same values in repeating section - InfoPath Dev
in

InfoPath Dev

Same values in repeating section

Last post 11-12-2008 07:36 AM by guptasourav. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-06-2008 11:59 AM

    Same values in repeating section

     Hi,

    I am using a repeating section in a readonly view. I want to add a unique ID from database to each section in the repearting section. 

    To achieve this I created a secondary datasource where I am recieving all the IDs. Then I pulled a textbox control in my repeating section. Set the default value of textbox as the value from secondary datasource.

    It gives me values but the values appear same in all the sections.I want different values in each section as in the secondary datasource has. For example 1st section should has an ID 123, 2nd 234, 3rd 567 ...and so on.

    Do any one know how to do this or some other approach.


    Thanks
    Sourav
  • 11-06-2008 08:35 PM In reply to

    Re: Same values in repeating section

     Can you please check again your binding of the secondary datasource to the repeating section? 

     

    Thanks,

    Paresh

     http://www.openzeas.com/blogs/Paresh

     

  • 11-06-2008 09:04 PM In reply to

    • Anuma
    • Top 25 Contributor
      Female
    • Joined on 07-20-2005
    • India
    • Posts 525

    Re: Same values in repeating section

    Hi,

     

    I think that text box field is a not repeating field in the schema. In the schema that field should be displayed under the repeating section group.   

     

    Anuma Chinthapalli /
    http://www.GGKTech.com
  • 11-07-2008 06:24 AM In reply to

    Re: Same values in repeating section

     Thanks Paresh and Anuma for your reply.

    My  textbox is under a repeating section group. To set the values in text box I went to Textbox properties--> Default Value --> fx --> Secondary datasource --> fieldname.

    This works but it shows me same values in all the section. The values is the first element in the recordset.

    Am I doing something wrong.

    Thanks
    Sourav
  • 11-11-2008 09:21 PM In reply to

    Re: Same values in repeating section

    I think, you are choosing different node from the secondary data source to set the value of textbox.

    Do let me know if you need more information.

     For more information, you can drop me a note on paresh[DOT]vs{AT}gmail[DOT]com

    Thanks,

    Paresh

     http://www.openzeas.com/blogs/Paresh

     

  • 11-12-2008 02:07 AM In reply to

    Re: Same values in repeating section

    Hi,

    Set the following xpath as default value to achieve your requirement.

     

    xdXDocument:GetDOM("secondary datasource name")/RootNode/RepeatingNode[count(preceding-sibling::RepeatingNode) = count(current()/../preceding-sibling::my:RepeatingNodeOfMainDataSource)]/IDFieldNode

     

    Example:

     xdXDocument:GetDOM("Emp")/Employees/Emp[count(preceding-sibling::Emp) = count(current()/../preceding-sibling::my:group2)]/EmpID 

     

    Swathip
    www.ggktech.com
  • 11-12-2008 07:36 AM In reply to

    Re: Same values in repeating section

     That worked Swathip. Thanks a ton for this. The only thing I had to change is, I removed the bold text and alter it a bit from the value and it worked.

    xdXDocument:GetDOM("Emp")/Employees/Emp[count(preceding-sibling::Emp) = count(current()/../preceding-sibling::my:group2)]/EmpID

    This is the solution that worked for me

    xdXDocument:GetDOM("Emp")/dfs:myFields/dfs:dataFields/ns2:Employees/Emp[(count(current()/../preceding-sibling::my:group2) + 1)]/EmpID 

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