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