Dear All,
I have recently been asked to assist a colleague on implementing some InfoPath forms, that use Sharepoint lists as there source of data.
The form I am implementing, is to list software required to be installed on PCs. We have a list on a sharepoint site, where these are stored, for example:
Item Cost Ongoing Costs
Paint shop pro £65 £32
Ms Project £95 £70
Adobe Acrobat £32 £22
I have a repeating table, which contains a combo box, bound to this table to retrieve the "Item" field. On each row is also two text boxes I am using for debugging purpose.
The combo box works fine, lists the "Item"s, and allows multiple "item"s to be selected, by adding new rows to the repeating table.
I am using (whether it be right, or wrong, I don't know - please advise!) a rule attached to the combo box to look up the price of that item, and I am using my two text boxes to debug these prices. The rule I am using is:
Set a fields' value: txtTempSWCost = @Cost[@Item = Software_Name]
Where @Item is the "Item" field in the sharepoint list, @Cost is the "Cost" field in the sharepoint list and Software_Name is the name of the combo box that I am selecting.
The problem I have, is that if I select "Paint Shop Pro" first, it returns the correct value of £65, but if I add a new row to the table, and choose, say "MS Project", that too comes back as £65. The really confusing part is that if I select as my first row "Adobe Acrobat", then any subsequent rows work fine - it is almost as if that the first row returns back all the data from the list UP TO the value selected, so if I choose "Paint Shop Pro", I only get that row from the list, but if I choose "Adobe Acrobat" I get returned all the rows.
The XPath for this, if it helps is:
xdXDocument:GetDOM("Price Software")/dfs:myFields/dfs:dataFields/dfs:Price_Software/@Cost[../@Item = xdXDocument:get-DOM()/my:myFields/my:SR_new_hardware/my:group68/my:group69/my:Software_Name]
I have read that the XPath method current() can be used to return the current item, I have tried it everywhere after the ../@item = part, and I get formula errors everytime!
I hope this makes sense, and someone can help, or advise an alternative way of looking up data from a sharepoint list for each drop down lit in a repeating table.
Thanks in advance,
James.
PS: I am using Infopath 2003.