EDITED sorry for the long post the last time. I have just put the code that is causing me the problem.. thanks again for all your help
Thank Matt
Good Morning all...
Big laugh here(laugh at myself).. one day I will understand all InfoPath... but until then thanks goodness for this web site.
Here is my new problem that I am running into..
with the help of Matt and everyone here I am able to load data fields into other data fields on a form with out a problem.
Now I have need to take a field from that table 'Email' and have that look up on "Contacts" from a SharePoint web service. What I have done so far is use a Rule to get this done.
here is the Rule that I am using.. it works but all very well..
Rule if Email is present Action is SingleName = concat(@Last_Name[@E-mail_Address = Email], " ", @First_Name[@E-mail_Address = Email]this will get great for me lastname firstname from the email cool..
then I do the same thing for the phone number and that works out great to.. for the first record..
the second record in the table will not have the correct information assigned to it.
Here is a table of what happens
Name Email Phone
Smith Steve [email protected] 999-XXYY
Jones James [email protected] 999-XXYY
what I am doing in code is appending child to contributor repeating list and then to get the field to refresh I am storing it in a temp and then putting it back to the field email on the form this process kicks off the rule that concat the lastname and firstname together and another rule puts the phone number in. I see want is happen little here.
I do not have the pointer when I am doing either task. when I am adding the new record to the repeating list I am at the end of the list, which is good. But when I running the rules I am at the beginning of the list and that where the problem of name not matching email or phone number.
Sorry for the long explanation here; just given background.
where I am having the problem is connecting and or reading a secondary datasource from code
here is the data struture
from the Contact list on sharepoint.
myFields (group)
dataFields (group)
Contacts(group)(repeating)
:Last_Name (field)
:First_Name (field)
:E-mail_address (field)
:Business_Phone (field)
Here is the code that I am using
I know if I can create a newnode and store everything in the new node and then append that child I will have a solution to this problem. where I am having problem and looking thought the how-to have helped a lot, but I am still not sure how to get the secondary datasource to work..
Function Display(ByVal data)
XDocument.UI.Alert(data)
End Function
Sub AddtoTable(strValue)
Dim iSelectedIndex
Dim objSelectedNode
dim objNode
dim objNewRow
dim objSimpleRow
Dim Temp
dim objContactEmail
Dim objContactEmailItem
Set objContactEmail = XDocument.GetDOM("Contacts")'.selectSingleNodes("/myFields/dataFields/Contacts/E-mail_Address") /dfs:myFields/dfs:dataFields/dfs:Contacts/@E-mail_Address
objContactEmail.setProperty "SelectionNamespaces","xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"""
Set objNode = XDocument.DOM.selectNodes("/my:Project/my:Contributors/my:Contributor" )
Set objSimpleRow = objNode.nextNode()
Set objNewRow = objSimpleRow.cloneNode(true)
Set objContactEmailItem = objContactEmail.selectNodes("/dfs:myFields/dfs:datafields/dfs:Contacts")
display(objContactEmailItem.selectSingleNode("@Last_Name").text)
On the preceeding line this is the error I get. I have namespace set and the the layout setup correctly I think..
Object Doesn't support this property or method 'objContactEmailItem.selectSignleNode'
objNewRow.selectSingleNode("/my:Contact/my:Email").text = strValue
iSelectedIndex = XDocument.DOM.selectNodes("/my:Project/my:Contributors/my:Contributor").length 'GetSelectedPartsIndex("/my:Project/my:Contributors/my:Contributor") '/my:Name/my:SingleName")
'Display("The recond Number is " & Cstr(iSelectedIndex))
XDocument.DOM.selectSingleNode("/my:Project/my:Contributors").appendChild(objNewRow)
if iSelectedIndex <= 2 then
XDocument.DOM.selectSingleNode("/my:Project/my:Contributors").removeChild(XDocument.DOM.selectSingleNode("/my:Project/my:Contributors").firstChild)
end if
'Display("The recond Number is " & Cstr(iSelectedIndex) & " The Record is " & XDocument.DOM.selectSingleNode( "/my:Project/my:Contributors/my:Contributor[" & Cstr(iSelectedIndex) & "]/my:Name/my:SingleName" ).text)
Temp = XDocument.DOM.selectSingleNode("/my:Project/my:Contributors/my:Contributor/my:Contact/my:Email").text
XDocument.DOM.selectSingleNode("/my:Project/my:Contributors/my:Contributor/my:Contact/my:Email").text = Temp
'XDocument.DOM.selectSingleNode("/my:Project/my:Contributors").lastChild
end sub
Thanks you in advance for all your help, what a great web site. So very helpful
Thanks again