Trying to populate a form field from another filtered list field - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Trying to populate a form field from another filtered list field

Last post 12-22-2017 09:14 AM by TOE_CHEESE. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 12-13-2017 02:29 PM

    Trying to populate a form field from another filtered list field

    Hi, I am building an InfoPath 2010 browser form that has a "target field" that gets it's value from a "source field" in another list. I have a secondary data connection on the list and I can bring the source field value into the target field on my form.  However the source field value will change over time and I need my target field to pull in the most recent source field value.  I need some help to build a filter to retrieve the most recent source value where another field equals a group name.  My thought is to use the modified date.

     This is what I am using to get the source field value into the target field...  xdXDocument:GetDOM("Receive")/dfs:myFields/dfs:dataFields/ns3:SharePointListItem_RW/ns3:Source_x0020_Field[../ns3:Group = "GOLD"] 

     Here is something I've tried... xdXDocument:GetDOM("Receive")/dfs:myFields/dfs:dataFields/ns3:SharePointListItem_RW/ns3:Source_x0020_Field[(../ns3:Group = "GOLD")][(../ns3:Modified = xdMath:Max(../ns3:Modified))]

     

    Any help is appreciated. 

  • 12-15-2017 08:11 AM In reply to

    Re: Trying to populate a form field from another filtered list field

     So you always need the most recent one? I think you are getting close with your XPath attempt - but the issue is your Max function uses a relative path to the modified field which is going to only compare to the current row.... This is just a guess, and my syntax may be wrong:

      xdXDocument:GetDOM("Receive")/dfs:myFields/dfs:dataFields/ns3:SharePointListItem_RW/ns3:Source_x0020_Field[(../ns3:Group = "GOLD")][(../ns3:Modified = xdMath:Max(../../ns3:SharePointListItem_RW/ns3:Modified))]

    Hilary Stoupa

  • 12-19-2017 10:48 AM In reply to

    Re: Trying to populate a form field from another filtered list field

     Hi Hilary,

     Sorry for not posting back sooner but I've been busy working through so many different combinations to achieve my goal.  I just could not get max(Modified) to return a value even without any additional filters.  I kept getting "NaN". 

    I went on to try concatenating the max(ID) with the Source Field which I could then successfully use max(concat_field) to get the most recent source total (concatenated). However getting the actual source field using the substring function becomes problematic after the ID increments from 1 to 2 then to 3 digits.  This may still be an option with some conditional rules.

    So now I am trying to use current() to get the source field where it equals max(ID).

     

    Falalalala Lalalala Tis the season.

  • 12-22-2017 09:14 AM In reply to

    Re: Trying to populate a form field from another filtered list field

     Following up my last post...  Here is the route I eventually took.

    I pushed the "Modified" into a calculated column as a contiguous string as =TEXT(Modified,"YYYYMMDDhhmm"). 

    This allow me to bring the "strModified" in as a field filtered as xdMath:Max(xdXDocument:GetDOM("Receive")/dfs:myFields/dfs:dataFields/ns3:SharePointListItem_RW/ns3:strModified[../ns3:Group = "GOLD"]). 

    I then used this xPath to get the most recent (last modified) total into my target field:  xdXDocument:GetDOM("Receive")/dfs:myFields/dfs:dataFields/ns3:SharePointListItem_RW/ns3:Target_x0020_Field[xdXDocument:get-DOM()/my:myFields/my:Totals/my:GOLDmax-modified = xdMath:Max(../ns3:strModified)]

      

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