I have a secondary data source I want to manipulate in JScript. I
have read just about every post on this subject, including the common
namespace issues, which I don't believe is an issue here.
First I would like to understand why Example 3 works when I use it on
a local data source (the result is the printing of all fields of a row
in a single dialog box) however when I try the same operation in
Example 2 it returns a blank dialog box. However if I use the code in
Example 1 and focus on one field I get that field returned for all
cases that pass the filter, one field her dialog box.
Second, my goal is to simply concatenate the Last_Name and First_Name
field for each row in the set returned from the "Workshop History"
DataObject (SharePoint list). If you know a much simpler way to do
this... and I am sure there is, please help as I have been working on
this for 2 days :-(. Thanks!
EXAMPLE 1: This code works
function CTRL194_5::OnClick(eventObj)
{
workshop = XDocument.DOM.selectSingleNode("/my:myFields/
my:Workshop").text
chosenDate = XDocument.DOM.selectSingleNode("/my:myFields/
my:ChosenDate").text
history = XDocument.DataObjects("Workshop History").DOM
history.setProperty("SelectionNamespaces",'xmlns:dfs="http://
schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:dsf="http://schemas.microsoft.com/office/infopath/2003/
dataFormSolution"' );
selectedHistory = history.selectNodes("/dfs:myFields/dfs:dataFields/
dfs:Workshop_History/Last_Name[../@Workshop = '" + workshop +"' and ../
@Workshop_Date = '" + chosenDate +"']")
var node;
while( ( node = selectedHistory.nextNode()) != null)
{
XDocument.UI.Alert(node.text)
}
EXAMPLE 2: (This code does not work)
function CTRL194_5::OnClick(eventObj)
{
workshop = XDocument.DOM.selectSingleNode("/my:myFields/
my:Workshop").text
chosenDate = XDocument.DOM.selectSingleNode("/my:myFields/
my:ChosenDate").text
history = XDocument.DataObjects("Workshop History").DOM
history.setProperty("SelectionNamespaces",'xmlns:dfs="http://
schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:dsf="http://schemas.microsoft.com/office/infopath/2003/
dataFormSolution"' );
selectedHistory = history.selectNodes("/dfs:myFields/dfs:dataFields/
dfs:Workshop_History[@Workshop = '" + workshop +"' and @Workshop_Date
= '" + chosenDate +"']")
var node;
while( ( node = selectedHistory.nextNode()) != null)
{
XDocument.UI.Alert(node.text)
}
EXAMPLE 3:
function doSubmit(eventObj) {
var nodeList = XDocument.DOM.selectNodes("my:myFields/
my:AttendGroup")
var node
while( ( node = nodeList.nextNode()) != null)
{
XDocument.UI.Alert(node.text)
}
Shiva (GGK Tech) - 01 Oct 2007 08:52 GMT
Hi,
First thing you have to use try and catch statements then we have a chance
to know what the error is and what type of error we are getting?
Did you check you are getting the ‘history’ document element? One more are
you can try for first xpath as below to get selected nodes:
selectedHistory = history.selectNodes("/dfs:myFields/dfs:dataFields/
dfs:Workshop_History[@Workshop = '" + workshop +"' and ../
@Workshop_Date = '" + chosenDate +"']/Last_Name ")
If above once also not working then you can try to give full XPath for
‘workshop’ and ‘chosenDate’ fields. For this field you didn’t specify any
prefix? What type of fields it is?
Hope this helps you

Signature
Shiva
http://www.ggktech.com
> I have a secondary data source I want to manipulate in JScript. I
> have read just about every post on this subject, including the common
[quoted text clipped - 69 lines]
> XDocument.UI.Alert(node.text)
> }