Set Target field of repeating table dynamically (Codeless) - InfoPath Dev
in

InfoPath Dev

Set Target field of repeating table dynamically (Codeless)

Last post 07-30-2013 12:19 AM by Patrick Halstead. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-24-2013 09:52 AM

    Set Target field of repeating table dynamically (Codeless)

    Hey everyone..  Many of these posts have been very helpful to me, but now I am faced with a new issue that I can't figure out.  I have a nested repeating table representing a secondary data source that looks like this:

    "SecDataSrc XML file1" 

    • Batch
      • Method (Repeating)
        • @ID
        • Field (Repeating)
          • @Name

    In my main data source, I have a couple of fields to store data for calculations.

    • TaskFields
      • text1
      • SB4

    What I want to do is set the Field with @Name= "myfield" and @ID = sb4 to some text string value.  seems simple right?  When modifying the manifest.xsf to place a filter on the targetField, this is what I get:

    Putting a constant in for the @ID value (say '26') works:

        <xsf:assignmentAction targetField="xdXDocument:GetDOM(&quot;SecDataSrc XML file1&quot;)/Batch/Method/Field[../@ID = '26' and @Name = &quot;myfield&quot;]" expression="concat(xdXDocument:GetDOM(&quot;SecDataSrc XML file1&quot;)/Batch/Method/Field[../@ID = '26' and @Name = &quot;myfield&quot;],' hi',xdXDocument:get-DOM()/my:myFields/my:TaskFields/my:SB4)"></xsf:assignmentAction>

    What I need is for '26' to be a variable referencing SB4:  So I copy the reference in the expression and paste it over the '26'.  This does not work:

    <xsf:assignmentAction targetField="xdXDocument:GetDOM(&quot;SecDataSrc XML file1&quot;)/Batch/Method/Field[../@ID = xdXDocument:get-DOM()/my:myFields/my:TaskFields/my:SB4 and @Name = &quot;myfield&quot;]" expression="concat(xdXDocument:GetDOM(&quot;SecDataSrc XML file1&quot;)/Batch/Method/Field[../@ID = '26' and @Name = &quot;myfield&quot;],' hi',xdXDocument:get-DOM()/my:myFields/my:TaskFields/my:SB4)"></xsf:assignmentAction>

    The error I get is is Unknown Method: "/Batch/Method/Field[../@ID = ---> xdXDocument:get-DOM <---  ()/my:myFields/my:TaskFields/my:SB4"

    Any ideas?  I have tried //my:SB4, ../my:SB4 but none of them work.  My rule that calls the action above is on the text1 field in the main data source. (It is used to calculate SB4).

     My other option is to use rules to set the fields.  (No code).  For each method in the data source, I want to set Field with @Name = "StartDate" to the value of that same Method's Field with @Name = "SOffset".  Both are strings.  Any Ideas on how to do this?  Either will work for me.

  • 07-27-2013 11:03 PM In reply to

    Re: Set Target field of repeating table dynamically (Codeless)

    Hi Lockettc and welcome!

    You could do this quite easily with qRules SetValue command and that does work in the browser, but it requires the sandbox.

    I've sent your query to one of our MVPs (Jimmy) to see if he can give you the right incantation.

    It should be doable via the manifest.xsf, but that probably won't work for browser forms. qRules SetValue will. Might be worth a look.

    More soon,

    Patrick Halstead
    Project Manager at Qdabra
  • 07-28-2013 08:10 PM In reply to

    Re: Set Target field of repeating table dynamically (Codeless)

     It would seem that you can't use xdXDocument:get-DOM() in the targetField portion of rule definitions. What you are trying to do can be accomplished very easily with a qRules command. Something like this:

    concat("SetValue /dsname=SecDataSrc XML file1 /xpath=/Batch/Method[@ID = '", SB4, "']/Field[@Name = 'myfield'] /value=", Method[@ID = SB4]/Field[@Name = 'myField'], ' hi', SB4)

     You mentioned that you can't use code. Is that because of a security limitation, or a maintainability limitation?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-29-2013 07:11 AM In reply to

    Re: Set Target field of repeating table dynamically (Codeless)

    Our environment is very secured.  We are unable to install anything on our machines, and have no access to Central Administration.  Even if we add a new solution to the solution gallery, it may not be able to be activated.  Additionally, if we put code in the forms, they will require Farm Admin approval, which won't happen.  So, I am basically an end user with only SCA rights in the site.  This is indeed a browser form, so my options are limited there too.  About the most I can do is edit the manifest in forms, or use jquery on sites.  IT frowns on jquery as they won't support it.

  • 07-30-2013 12:19 AM In reply to

    Re: Set Target field of repeating table dynamically (Codeless)

    Jimmy's got a technique that doesn't use qRules but it's quite complex. He should have time in a day or so to respond with the added detail.

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.