Creating a loop from a Web Service data source failing - InfoPath Dev
in

InfoPath Dev

Creating a loop from a Web Service data source failing

Last post 07-15-2008 11:36 AM by CherokeeKid. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-14-2008 11:43 AM

    Creating a loop from a Web Service data source failing

    I have a form view with a repeating table bound to a Secondary web service data source. I want to create a
    jscript event that will loop through all the nodes and set the value of a node in each row.

    I have reviewed and tried several examples, but nothing works. When I try to create the While or For loop,
    some cases will get the first record only, other attempts return no records or errors as below.


    var oSelAllDOM = XDocument.DataObjects["GetFilteredDataset"];

    var oSelAll = XDocument.GetDOM("GetFilteredDataset");

    oSelAll.setProperty("SelectionNamespaces",' xmlns:ns2="http://tempuri.org/WALookupDS.xsd" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:tns="http://tempuri.org/" ');

    var oViewSels;
    var oViewSel;

    oViewSel = oSelAll.selectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetFilteredDatasetResponse/tns:GetFilteredDatasetResult/ns2:WALookupDS");
    // I can verify the text and xml is being returned when viewed in the QuckWatch debugger

    oViewSels = oViewSel.SelectNodes(); // object doesn't support the method or property

    any help would be appreciated.

  • 07-14-2008 10:39 PM In reply to

    Re: Creating a loop from a Web Service data source failing

    If you want to set all records to a value you can use a set field action.  If it is triggered from outside the repeating structure and does not ahave a filter for a specific row then by default all repeating fields will be set with the value.

  • 07-15-2008 11:36 AM In reply to

    Re: Creating a loop from a Web Service data source failing

     Thanks Clay for the suggestion. I will try it. I still need the ability to loop through the nodes. Below is what I have tried so far. 

    Using Secondary (Web Service) data source. 

     

    In the Form View I query the "GetFilteredDataset" and populate a repeating table.

     

    On Button Click event I attempt to loop thru the nodes with the goal of setting one node to "true"

     

    oSelAll.setProperty("SelectionNamespaces",'

                xmlns:ns2="http://tempuri.org/WALookupDS.xsd"

                xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"          

                xmlns:tns="http://tempuri.org/" ');

     

     

    // This works - returns the correct dataFields nodes with correct data shown in the QuickWatch from the Data Source

    oViewOne = XDocument.GetDOM("GetFilteredDataset").selectSingleNode(

    "/dfs:myFields/dfs:dataFields/tns:GetFilteredDatasetResponse/tns:GetFilteredDatasetResult/ns2:WALookupDS");

      

    // DOES NOT WORK - it returns the queryFields nodes defined in the QuickWatch window

    // but with dataFields data

     oViewSel = XDocument.GetDOM("GetFilteredDataset").selectNodes(

    "/dfs:myFields/dfs:dataFields/tns:GetFilteredDatasetResponse/tns:GetFilteredDatasetResult/NewDataSet/Table");

     

    // DOES NOT WORK -Same as above

    oViewSels= XDocument.GetDOM("GetFilteredDataset").selectNodes(

    "/dfs:myFields/dfs:dataFields/tns:GetFilteredDatasetResponse/tns:GetFilteredDatasetResult/ns2:WALookupDS");

     

    // returned correct node count  of dataFields but data and nodes are incorrect (same as above)

    oViewCnt = XDocument.GetDOM("GetFilteredDataset").selectNodes(

    "/dfs:myFields/dfs:dataFields/tns:GetFilteredDatasetResponse/tns:GetFilteredDatasetResult/ns2:WALookupDS/ns2:WAPrimary").length;

      

    Since I cannot get the selectNodes to work, I cannot build a loop to iterate the nodes

     

     

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.