Infopath 2007 vegyes

A bejegyzés kategóriája: Nincs kategorizálva
Kiemelt szavak: .
Közvetlen link.

Infopath 2007 vegyes bejegyzéshez 2 hozzászólás

  1. Döme hozzászólása:

    http://www.infopathdev.com/forums/p/10823/38566.aspx

    Filter sharepoint list by value from infopath form with xpath
    Reply Contact

    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
    o
    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 = ], “-”)’), “..”))

    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 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…!

  2. Döme hozzászólása:

    http://coleshiflett.wordpress.com/2010/03/23/infopath-2007-%E2%80%93-using-a-sharepoint-list-source-with-a-calculated-column/
    InfoPath 2007 – Using a SharePoint list source with a calculated column
    March 23, 2010 cshiflett Leave a comment Go to comments

    undefined

    A common way to populate a drop-down list box control in InfoPath is to bind it to a SharePoint list data source. Not difficult at all, of course, and a great way to leverage dynamic data managed in SharePoint and make that data available to your InfoPath users. It’s also common to have some action take place based on the user’s selection in that control. A common use case, for example, is to populate other controls based on the selected item. The data you use could be from other columns within that same list, for example. Not a huge deal, right? Assuming you are using the no-code solution, you will run into an issue *if* you want to return data from a calculated column – you will not see that column in the list of available columns.

    I ran across this recently when I had bound a drop-down list control to a small SharePoint list of Shipping Addresses. The list contained the Location Code in the Title column, which served as my drop-down values on the form, and the rest of the columns were the individual address attributes (Address1, Address2, Address3, City, State, and Postal Code). The extra address columns were used to accommodate things such as suites, floors, attention lines, rooms, etc. To accommodate the range of addresses, I created 2 calculated columns, one concatenating the address lines and one doing the same with the city, state and postal code. Unfortunately, using the typical method of returning list columns using a properties filter didn’t work because the columns were of the calculated sort. There is a work-around, which is detailed below: