Copy from one Group to another - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Copy from one Group to another

Last post 02-17-2010 09:59 AM by Hilary Stoupa. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 01-27-2010 07:20 AM

    Copy from one Group to another

    Hi,

    I have a non-repeating group of fields I want to copy to another non-repeating group.  I'm not sure whether to use CopyTable or Replace.  Also, I'm not exactly sure what Replace does.  Does it copy the data into the corresponding fields (by field name)?  Or does it replace the entire structure under the source and destination path?  Is that why it's called Replace instead of Copy?

    The error I'm getting is "Failed to replace the destination node".  My Command looks like this:


    Replace /xpathsrc=/my:myFields/my:Group1 /xpathdest=/my:myFields/my:Group2 

    Under each Group are 2 text fields.

    Group1 has text1, text2

    Group2 has text3, text4

    I also tried to use CopyTable to do this but couldn't get that to work either, probably because this isn't a repeating table.

     

    And an unrelated question, if I display the Command field on a form should it show up, or does the field immediately get cleared out after the command executes?

    Thanks,

    Dave

     

    Filed under:
  • 01-28-2010 05:43 AM In reply to

    Re: Copy from one Group to another

    Hi Dave,

    The command field gets cleared out after it executes.

    From your description of the data structure it sounds like you are correct in trying Replace. The error message is telling us that the command cannot locate the source node. Though perhaps the real issue is that the data structures must match. From the mismatch above (source is Attachments and destination is my:Attachments) I think the command will run into issues.

    Because of that, perhaps we should look at using CopyTable instead, which is more flexible in handling the data structure. Can you try that? If you run into issues, can you attach the file (or screenshots of the data source)?

    Thanks,

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 01-28-2010 05:50 AM In reply to

    Re: Copy from one Group to another

     

    Hi,

    Thanks for the reply.  Unfortunately, I was modifying my question to simplify it, as you were responding.  In my original question I forgot to specify the dsnamesrc.  However, this didn't help.

     

    Could you take a look at the replaced question above??

    Thanks,

    Dave

     

  • 01-28-2010 06:11 AM In reply to

    Re: Copy from one Group to another

    No problem. Thanks for clarifying the scenario.

    Replace won't work because of the structure mis-match.

    CopyTable won't work because these are not repeating structures.

    Is it possible to re-do the data source so that the source and destination match?

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 01-28-2010 06:20 AM In reply to

    Re: Copy from one Group to another

    I don't understand.  Each group has 2 text fields.  How is it a structure mis-match?

    Do the text-field names have to match too?  How can I do that when infopath doesn't allow fields with the same name within a single data source?

     

     

     

  • 01-28-2010 06:40 AM In reply to

    Re: Copy from one Group to another

    Yes, the field names must match as well. To do this, right click on group1 and select Reference. Select a different location and InfoPath will replicate group1 in that location. See the attached screenshot for an example.


    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 01-28-2010 08:13 AM In reply to

    Hi,

     

    Thanks. Replace worked for the example on Main.  But I want to go from a secondary source to Main. 

    The attached photo shows my datasources.  I want to copy (or Replace?) from the top one to the bottom one.  I'm guessing I should use CopyTable. Although I used CopyTable before I'm not sure what would be the table and what would be the Row for the source and dest in this case.  I tried Replace but that probably doesn't work because of the repeating table.

    Here's my CopyTable command:

    CopyTable /tablesrc=/dfs:myFields/dfs:dataFields/ns1:GetRecordsResponse/ns1:GetRecordsResult/NewDataSet

    /rowsrc=LU_EducationLevel /tabledest=/my:myFields /rowdest=my:LU_EducationLevel /dsnamesrc=GetRecords

    and here's the error I get:

    An error has occurred executing the rule. The table row of the source and destination must contain the same number of elements and attributes.

    Dave

     

     


    Filed under:
  • 01-29-2010 09:04 AM In reply to

    Re: Copy from one Group to another

    Hi Dave,

    The problem is in the schema: there is still a mismatch.

    In the source you have (Choice) as the repeating node, with LU_EducationLevel as a subgroup. In the destination you have LU_EducationLevel as the repeating node.

    You'll want to modify the destination to have a repeating group, with a group under it, then your three nodes. That should allow CopyTable to work.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 01-29-2010 09:34 AM In reply to

    Ernesto,

    I appreciate you helping with this. I'd really like to get it working. What you suggested doesn't work either. 

    I think the problem has something to do with the (Choice) node, which doesn't get mentioned at all in my QRules command.  I don't completely understand Choices and noticed that you can't Copy the XPath for that node.  Here's my command.  Shouldn't Choice be in there someplace?  Do I include the parenthesis?

    CopyTable /tablesrc=/dfs:myFields/dfs:dataFields/ns1:GetRecordsResponse/ns1:GetRecordsResult/NewDataSet 

    /rowsrc=LU_EducationLevel /dsnamesrc=GetRecords

    /tabledest=/my:myFields/my:Group4 /rowdest=my:LU_EducationLevel

     

    Here is the XPath from LU_EducationLevel under the GetRecords secondary datasource. Is the problem that this is not a table since it seems to skip right over the Choice node?

    /dfs:myFields/dfs:dataFields/ns1:GetRecordsResponse/ns1:GetRecordsResult/NewDataSet/LU_EducationLevel

    My new datasources are shown below.  I still get an "elements or attributes" mismatch.

    Dave

     


  • 01-29-2010 08:09 PM In reply to

    Re: Copy from one Group to another

     Hello and thank you for using qRules.

     (Choice) is not a node here, but an indicator in the taskpane to show that there should be 0 or 1 LU_Educational nodes underneath the NewDataSet node.  That could have something to do with the trouble you're having but let's try a few more things to try to make this work.

     One issue with your command is that the /rowdest parameter needs to indicate a repeating node (I think Ernesto slightly misunderstood this point).  Could you try changing your data source to make my:Group4 non-repeating and change my:LU_EducationLevel to be repeating, and then try the command again in its current format?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-30-2010 10:23 AM In reply to

    Re: Copy from one Group to another

    Jimmy,

    I fixed that problem but get the same result; An error has occurred executing the rule. The table row of the source and destination must contain the same number of elements and attributes.

     I noticed that in the secondary datasource, that LU_EducationLevel does not appear as repeating, even though there are multiple rows of them.  It's probably becasue Choice appears as repeating, but does QRules know that? 

    Let me know if there's something else I can try, or if you need to see something else in my test project.  I'd be glad to post any screenshots that might help.

    Dave

     

  • 02-02-2010 11:38 AM In reply to

    Re: Copy from one Group to another

    So is there any way to copy the contents of a returned Dataset from a secondary connection, to Main, other than copying one field at a time?

     

     

     

  • 02-17-2010 09:59 AM In reply to

    Re: Copy from one Group to another

    Hi, David:

    You have another post on your web service, about rewriting it so it doesn't return a choice group. Did that correct this issue for you so that you could use the CopyTable command in qRules?

    Hilary Stoupa

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