Filter sharepoint list by value from infopath form with xpath - InfoPath Dev
in

InfoPath Dev

Filter sharepoint list by value from infopath form with xpath

Last post 04-28-2010 08:26 PM by [email protected]. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-18-2009 06:20 AM

    • girokonto
    • Not Ranked
      Male
    • Joined on 02-18-2009
    • Munich, Germany
    • Posts 5

    Filter sharepoint list by value from infopath form with xpath

    Hello everyone,

    before I continue, one important thing has to be mentioned: I must NOT use code! The problem has to be solved without writing any C#/VB code.

     

    I have a browser enabled Infopath 2007 form, one secondary data source and (of course) the primary data source.

    The secondary data source is a sharepoint list from which I want to retrieve some data by filtering it. The filtered data then has to be copied into a text field (let’s call it text_from_list) on my form for further use.

     

    The structure of the sharepoint list is as follows:

    •  myFields
      • dataFields
        • MyTextList (being a repeated group)
          • :item_id
          • :some_text

    What I want to do is select only rows from the MyTextList with a certain @item_id and concatenate the @some_text-data into the text_from_list field. The ID is entered by the user into a number field (called filter_id) on my form.

     

    From a post in this forum (http://www.infopathdev.com/forums/p/7124/30263.aspx#30263) I already figured out how the xpath expression has to look like. To populate text_from_list the default value of this field has to be:

    xdMath:Eval(xdMath:Eval(xdXDocument:GetDOM("MyTextList")/dfs:myFields/dfs:dataFields/dfs:MyTextList, 'concat(@some_text[../@item_id = <ID from field filter_id>], "-")'), ".."))

     

    As I understand it, this xpath expression does the following: “loop over all rows in MyTextList and concatenate all @some_text-data (separated by a dash) where @item_id equals the number that was entered in field filter_id”.

     

    Now, the problem is that I am not able to figure out how the condition <ID from field filter_id> has to be set.

    I tried my:root/my:filter_id but when I preview the form, Infopath tells me that “Infopath cannot open the selected form”.

    Then I tried the fully qualified path to the filter_id field: xdXDocument:get-DOM()/my:root/my:filter_id, but again Infopath refuses to validate the xpath expression.

     

    However, when I set the following: …concat(@some_text[../@item_id = 5]…, (meaning: when I hard-code the ID) then my text_from_list field gets populated properly!!

     

    Can anybody please help me on that?

     

    Thank you very much…!

  • 02-18-2009 11:15 PM In reply to

    Re: Filter sharepoint list by value from infopath form with xpath

    Hi Girokonto and welcome to our forum,

    How about a nested concat for the inner string? Something like: concat('concat(@some_text[../@item_id =',<filter_id>,'],"-")')

    Or, you could just use our QuerySharePoint Web Service:

    The benefits of our Web Service are:

    1. Performance: the Web service executes the filter on the server and only sends you the matches -
    2. Quick and Easy: user our Query Builder Tool to build your queries
    3. Low Cost of Ownership: no code and no hairy xpaths to execute or maintain

    Qdabra's goal in life is to help InfoPath form builders. We do this by providing this forum free-of-charge. Our goal is to respond within 48 hours to every post. Sometimes we don't, but we sure strive too. We also provide free tools and low cost solution accelerators for people so that they can realize the promise of InfoPath to reduce IT expenses. With InfoPath and Qdabra, business process analysts can build code-free forms-based solutions.

    Wanna a free demo? Just send us e-mail.

    Patrick Halstead
    Project Manager at Qdabra
  • 03-02-2009 04:48 AM In reply to

    • girokonto
    • Not Ranked
      Male
    • Joined on 02-18-2009
    • Munich, Germany
    • Posts 5

    Re: Filter sharepoint list by value from infopath form with xpath

    Hello again,

    perhaps my description of the problem was too complex (I wanted to be as exact as possible but in fact I’m struggling with the English language).

     

    So here - in short - my problem again:

    1. I have an Infopath form and on it I have an input field, called form_filter_id.
    2. I have a Sharepoint list, called MyTextList. The list has two columns: list_item_id and list_some_text. The list_item_id is not unique, there are several list rows with the same list_item_id.
    3. I must not use code (c# or whatever), only xpath-expressions are allowed.

    I want to concatenate text from the column list_some_text, but I want to concatenate only those list_some_text-entries that satisfy the following condition:

    list_item_id = form_filter_id

     

    How can this be done?

     

    The solution that was proposed by Patrick did not work.

     

    Thank you in advance!

  • 04-28-2010 08:26 PM In reply to

    Re: Filter sharepoint list by value from infopath form with xpath

    Check out this Filtered List Lookup Web Service  utility - I believe it will solve your issue and more! 

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