Multi-Picklist from SharePoint List

R

robot smiff

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
 
R

robot smiff

S

S.Y.M. Wong-A-Ton

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


robot smiff said:
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




robot smiff said:
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
 
S

S.Y.M. Wong-A-Ton

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


robot smiff said:
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;
}
}
}














S.Y.M. Wong-A-Ton said:
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


robot smiff said:
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
 
R

robot smiff

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;
}
}
}














S.Y.M. Wong-A-Ton said:
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


robot smiff said:
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




robot smiff said:
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
 
R

robot smiff

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

S.Y.M. Wong-A-Ton said:
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


robot smiff said:
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;
}
}
}














S.Y.M. Wong-A-Ton said:
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
 
S

S.Y.M. Wong-A-Ton

I'm not sure that I get you. How can you recognize whether a software profile
is current or not? Are you saving an indicator field on the software profile?
And do you want to filter in SharePoint or in InfoPath?
---
S.Y.M. Wong-A-Ton


robot smiff said:
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

S.Y.M. Wong-A-Ton said:
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


robot smiff said:
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
 
R

robot smiff

Thanks for the help...

First, the "current" attribute is set in SharePoint in a list called
SoftwareProfiles using a SharePoint checkbox.

When my InfoPath form opens, it gathers the items in the list into a
repeating table. I need it only to gather the items where Current is
checked. I don't want my users to be able to pick a software title that's
not current.

Second, I'm not quite getting the loop through code to delete all the nodes.
I get the code from your source that goes:

Set objXMLDOMElement = objDOMDocument.documentElement.firstChild

Set objRemovedElement =
objDOMDocument.documentElement.removeChild(objXMLDOMElement)

But I'm having trouble objDOMDocument. This repeating table is in my form's
main data source. I'm not sure how to get all the nodes in the group to loop
through and delete them.

Thanks again!
JK




S.Y.M. Wong-A-Ton said:
I'm not sure that I get you. How can you recognize whether a software profile
is current or not? Are you saving an indicator field on the software profile?
And do you want to filter in SharePoint or in InfoPath?
---
S.Y.M. Wong-A-Ton


robot smiff said:
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

S.Y.M. Wong-A-Ton said:
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
 
S

S.Y.M. Wong-A-Ton

Since the repeating table is in your Main data source, you can use the
"Filter Data..." option on the properties dialog box for the repeating table
to filter on "current".

You cannot use the code posted on www.topxml.com without modifying it to
suit your needs. "objDOMDocument" would be equivalent to the repeating group
node in your case (dfs:SoftwareProfiles I'm guessing). You need to build a
while loop checking whether hasChildNodes() on the group returns true. If it
does, retrieve the firstChild node on the group and then remove it from the
group. For information on the "while" statement in JScript, check out the
JScript reference at http://www.micrsoft.com/scripting

You could also use ExecuteAction with a "remove" action to delete a row in
the repeating table in pretty much the same way you used ExecuteAction to
"insert" a row.

---
S.Y.M. Wong-A-Ton


robot smiff said:
Thanks for the help...

First, the "current" attribute is set in SharePoint in a list called
SoftwareProfiles using a SharePoint checkbox.

When my InfoPath form opens, it gathers the items in the list into a
repeating table. I need it only to gather the items where Current is
checked. I don't want my users to be able to pick a software title that's
not current.

Second, I'm not quite getting the loop through code to delete all the nodes.
I get the code from your source that goes:

Set objXMLDOMElement = objDOMDocument.documentElement.firstChild

Set objRemovedElement =
objDOMDocument.documentElement.removeChild(objXMLDOMElement)

But I'm having trouble objDOMDocument. This repeating table is in my form's
main data source. I'm not sure how to get all the nodes in the group to loop
through and delete them.

Thanks again!
JK




S.Y.M. Wong-A-Ton said:
I'm not sure that I get you. How can you recognize whether a software profile
is current or not? Are you saving an indicator field on the software profile?
And do you want to filter in SharePoint or in InfoPath?
---
S.Y.M. Wong-A-Ton


robot smiff said:
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
 
S

S.Y.M. Wong-A-Ton

Additional info: You can use XDocument.View.SelectNodes (see
http://blogs.msdn.com/infopath/archive/2004/04/07/109189.aspx) to select all
the nodes in the repeating table, and then call ExecuteAction with a "remove"
to delete all the rows.
---
S.Y.M. Wong-A-Ton


robot smiff said:
Thanks for the help...

First, the "current" attribute is set in SharePoint in a list called
SoftwareProfiles using a SharePoint checkbox.

When my InfoPath form opens, it gathers the items in the list into a
repeating table. I need it only to gather the items where Current is
checked. I don't want my users to be able to pick a software title that's
not current.

Second, I'm not quite getting the loop through code to delete all the nodes.
I get the code from your source that goes:

Set objXMLDOMElement = objDOMDocument.documentElement.firstChild

Set objRemovedElement =
objDOMDocument.documentElement.removeChild(objXMLDOMElement)

But I'm having trouble objDOMDocument. This repeating table is in my form's
main data source. I'm not sure how to get all the nodes in the group to loop
through and delete them.

Thanks again!
JK




S.Y.M. Wong-A-Ton said:
I'm not sure that I get you. How can you recognize whether a software profile
is current or not? Are you saving an indicator field on the software profile?
And do you want to filter in SharePoint or in InfoPath?
---
S.Y.M. Wong-A-Ton


robot smiff said:
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
 
B

_bizon

InfoPath gets only what SharePoint list has in its' default view...
So the simplest approach is to create in WSS a view called current, make it
default and filter it there (careful with the item limit - you'll get just
the first 100 if this is the setting in the SharePoint view)...

--
Liviu


robot smiff said:
Thanks for the help...

First, the "current" attribute is set in SharePoint in a list called
SoftwareProfiles using a SharePoint checkbox.

When my InfoPath form opens, it gathers the items in the list into a
repeating table. I need it only to gather the items where Current is
checked. I don't want my users to be able to pick a software title that's
not current.

Second, I'm not quite getting the loop through code to delete all the nodes.
I get the code from your source that goes:

Set objXMLDOMElement = objDOMDocument.documentElement.firstChild

Set objRemovedElement =
objDOMDocument.documentElement.removeChild(objXMLDOMElement)

But I'm having trouble objDOMDocument. This repeating table is in my form's
main data source. I'm not sure how to get all the nodes in the group to loop
through and delete them.

Thanks again!
JK




S.Y.M. Wong-A-Ton said:
I'm not sure that I get you. How can you recognize whether a software profile
is current or not? Are you saving an indicator field on the software profile?
And do you want to filter in SharePoint or in InfoPath?
---
S.Y.M. Wong-A-Ton


robot smiff said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top