Setting a field value based on a dropdown not displaying repeating values - InfoPath Dev
in

InfoPath Dev

Setting a field value based on a dropdown not displaying repeating values

Last post 06-15-2012 12:22 PM by Jimmy. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 12-20-2011 12:51 AM

    Setting a field value based on a dropdown not displaying repeating values

    I have a dropdown that pulls its source data from MSSQL.  The dropdown populates various views based on the reference (RiskRef) that is selected in the dropdown.  The dropdown is not inside a repeating section or table.

    It works fine where there is only one line of item to display, but where there is a one to many relationship, I need to display the data in a repeating section.  Unfortunately if I use the rule to set the field value based on the dropdown, it populates only the first line from the database.  Thus all my repeating sections have only one entry.  The SQL query is a secondary data source using a view (View_XXXXX).  For example, if I have a risk called RISK1, it may have multiple controls attached to it:  CTRL1, CTRL2, CTRL3, etc.  Unfortunately it only displays CTRL1 and none of the others.

     

    The setup looks like this:

    View 1:

    Dropdown of items (RiskRefDropDown)

     

    View 2:

    Risk information (all fields populated based on the @RiskRef and working fine).  An example of a field set rule is: 

    xdXDocument:GetDOM("View_XXXXX")/dfs:myFields/dfs:dataFields/d:View_XXXXX/@GrossExp[../@RiskRef = xdXDocument:get-DOM()/my:CustomFields/my:RiskSection/my:RiskRefDropDown]

     

    View 3:

    Control information (all data reside in repeating sections, but it only displays the first row from the database).  The backend database have multiple tables linked by a field called RiskRef.  Because the view has multiple references to RiskRef, it has changed some of the fields to Expr instead.  Thus an example of a field set rule is:

    xdXDocument:GetDOM("View_XXXXX")/dfs:myFields/dfs:dataFields/d:View_XXXXX/@ControlOwner[../@Expr1 = xdXDocument:get-DOM()/my:CustomFields/my:RiskSection/my:RiskRefDropDown]

     

     

    Is there something wrong with my XPath that it only displays one row in a repeating section?  Or is there something else I need to do?  Any assistance would be much appreciated!

  • 12-20-2011 12:34 PM In reply to

    Re: Setting a field value based on a dropdown not displaying repeating values

    i just read on another post that the only way to do this would be to use code.  I know far too little about C# or VB to try figure it out on my own.  Can anyone point me to online resources or books that cover how to create the code to populate the additional rows in my repeating tables using the RiskRefDropDown value?

  • 12-24-2011 03:03 AM In reply to

    Re: Setting a field value based on a dropdown not displaying repeating values

    I eventually just created different forms for each of the RiskRef's I would need to use. 
  • 06-14-2012 05:57 AM In reply to

    Re: Setting a field value based on a dropdown not displaying repeating values

    Hello ladyath , I am facing the same issue. Did you got any solution ?
    Thanks,
    Chintan
  • 06-15-2012 06:56 AM In reply to

    Re: Setting a field value based on a dropdown not displaying repeating values

    The only solutions I ever found required code and at the time I had to work on this issue that was simply not an option.  Unfortunately I do not have those links anymore, but Google gave me some info - I was just not able to apply it.  Good luck!
  • 06-15-2012 12:22 PM In reply to

    Re: Setting a field value based on a dropdown not displaying repeating values

    Do you need to be able to populate the repeating table with data from the secondary data source, or just display a read-only table of the associated data?  For the latter, all you would need is a filtered repeating table that's bound to the secondary data source.  The former is a bit trickier, but there are probably ways to accomplish it marginally well with a completely codeless approach, and even better with qRules.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.