hey! That's great! Thanks for the help.
I may have not been clear. I need to filter the "Source" list. My list of
software profiles in SharePoint include some that are current and some that
are not. I only want the current ones in my source list, the one with the
check boxes.
Thanks again!
JK
:
1. Loop through all the child nodes under the group and use removeChild to
remove the node from the documentElement (see
http://www.topxml.com/xml_dom/removechild.asp#P4568_107927)
2. When adding the items to the group (after having cleared all nodes from
the group), add a check that says only add the node to the group if "current"
is true.
---
S.Y.M. Wong-A-Ton
:
I got this to work using thes code below for the buton.
Apparently, the SharePoint data is accessed in the same name space as the
InfoPath data, i.e. ../infopath/2003/dataFormSolution or "xhtml:dfs"
I still need to do two things.
One, I need to blank the target table before I start writing values to it.
As it is now, everytime I click, the selected values are appended to what
could be a partially filled out list.
Two, I need to be able to filter the SharePoint source. Our Software
profiles support life cycle and I only want titles with the "current" value
equal to true.
Thanks for helping!
here's the code.
function CTRL14_5::OnClick(eventObj)
{
//Get a reference to the Table1 data connection
var objTable1DOM = XDocument.GetDOM("SoftwareProfiles");
//Set the SelectionNamespaces property of the Table1 data connection to walk
the DOM
objTable1DOM.setProperty("SelectionNamespaces",
'xmlns:dfs="
http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ' +
'xmlns:xd="
http://schemas.microsoft.com/office/infopath/2003"');
//Get the selected items
var objSelectedItems =
objTable1DOM.selectNodes("//dfs:myFields/dfs:dataFields/dfs:SoftwareProfiles[@Selected = 'true']");
//Loop through the selected items
for(i=0;i<=objSelectedItems.length -1;i++)
{
//See if the first record in the destination Repeating Table is blank
if(XDocument.DOM.selectSingleNode("//my:group12/my:group13/my:field46").text
== "")
{XDocument.DOM.selectSingleNode("//my:group12/my:group13/my:field46").text =
objSelectedItems(i).attributes(0).text;
}
else
{
//Add a new row
XDocument.View.ExecuteAction("xCollection::insert", "group13_20");
//Get a reference to that new row
var objNewItem =
XDocument.DOM.selectSingleNode("//my:group12/my:group13[last()]/my:field46");
//Set the text of the field
objNewItem.text = objSelectedItems(i).attributes(0).text;
}
}
}
:
You might be right on both occasions as to where your problem lies. Try
adding some debugging code to your code to find out what is going on. For
example, add
XDocument.UI.Alert(XDocument.GetDOM("<your_sharepoint_list>").xml);
to your code. This should contain enough information on namespaces and the
"yes/no" issue to solve your problem. If you are still unable to solve it and
the XML is not too long, post the XML.
---
S.Y.M. Wong-A-Ton
:
I think the problem is in the .selectionnamespace object.
The Access solution reads like this:
//Set the SelectionNamespaces property of the Table1 data connection to walk
the DOM
objTable1DOM.setProperty("SelectionNamespaces",
'xmlns:dfs="
http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ' +
'xmlns:d="
http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"');
I think the "xmlns:d.." value needs to be something else.
Anybody can help!
Thanks!
-robot
:
Scott Heim has posted here
(
http://msdn.microsoft.com/newsgroup...360b1b-55ff-4c50-9cb3-9cd954359fa4&sloc=en-us)
a working solution to create a multipicker from a list sourced in an access
database.
I'm trying to get it sourced from a SharePoint list.
Do I just need to change his references to "Table1" to "MyList"?
The SharePoint Boolean is "Yes\No" So I suppose I need to search for values
of "yes" instead of "Tue"
I think I'm having trouble with this line:
objTable1DOM.selectNodes("//dfs:myFields/dfs:dataFields/d:Table1[@Selected =
'True']");
Especially the "d:table1"
Should it read: ../d:MyList[@Selected = 'Yes']");
Thanks!
JK