Repeating groups containing repeating groups - InfoPath Dev
in

InfoPath Dev

Repeating groups containing repeating groups

Last post 08-04-2005 06:38 AM by bobstery. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-04-2005 03:25 AM

    Repeating groups containing repeating groups

    I have the following structure (simplified for this illustraion):

    my:Fields
    my:Results
    jobid
    address
    postcode
    my:Activity
    type
    serialnum
    action

    I am trying to dynamically call a stored procedure to produce the my:Activity elements if the jobid from my:Results returns any elements when calling the stored procedure with the jobid value.

    See my code below (which is called after the user has selected a row and clicked on a button):


    var jobid = eventObj.Source.selectSingleNode("my:jobid").text
    XDocument.DataAdapters("JobColl").Command = "execute getJobActivity "+ jobid;

    XDocument.DataAdapters("JobColl").Query();

    var jobResults = XDocument.GetDOM("JobCol").getElementsByTagName("d:JOBCOL");

    for(var j=1;j<jobResults.length+1;j++)
    {
    var oNode = XDocument.DOM.selectSingleNode("/dfs:myFields/my:Results/my:Activity");

    oNode = oNode.cloneNode(true);

    oNode.selectSingleNode("my:serialnum").text = XDocument.GetDOM("JobCol").selectSingleNode("/dfs:myFields/dfs:dataFields/d:JOBCOL["+j+"]/@jbcl_serialnum").text;

    parent = XDocument.DOM.selectSingleNode("/dfs:myFields/my:Results");
    parent.appendChild(oNode);
    }


    I tried to make the parent the individual element of my:Results corresponding to the job id e.g.

    parent = XDocument.DOM.selectSingleNode("/dfs:myFields/my:Results[ntlid="+jobid+"]");

    However it stated that the value was null or not an object.

    However when trying to add the oNode to the Parent I get the following error:

    Element {http://schemas.... } 'Activity' is unexpected according to the content model of parent element
    {http://schemas... } 'Results'


    The format is correct though, does anybody see anything obvious.

    Many Thanks
  • 08-04-2005 06:38 AM In reply to

    Re: Repeating groups containing repeating groups

    I have now figured it out, the problem was that the repeating group had been created once when the parent node (i.e my:Results) had originally been created, however there were other elements below the repeating group (i.e. my:Activity) that belonged to my:Results, therefore when I tried to add nodes to my:Activity I got a schema error as the node can only be created in order of how the schema expects.
    I therefore moved the repeating group my:Activity to the bottom of the my:Results repeating group.
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.