J
JustinDevine
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)
}
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)
}