Copy field values in Repeating Section - InfoPath Dev
in

InfoPath Dev

Copy field values in Repeating Section

Last post 12-14-2010 10:36 AM by greenawayr. 23 replies.
Page 2 of 2 (24 items) < Previous 1 2
Sort Posts: Previous Next
  • 12-10-2010 11:36 AM In reply to

    Re: Copy field values in Repeating Section

    You have some switched commas and quotes right here:

    concat("SetValue /xpath=dfs:myFields/dfs:dataFields/tns:GetFormDatasetResponse/tns:GetFormDatasetResult/ns1:dsForms/ns1:Clients[, "

    That should be [",

    That being said, it seems like it might be helpful to clarify for you how the concat formula works. The concat formula takes as arguments comma separated values, like:

    concat(field1, field2, "Some text")

    Anything that is a field or a formula would not be in quotes, anything that is a regular bit of text would be in quotes, like the concat above. So, let's pretend that field1 has a value of "grape" and field2 has a value of "orange" and we are going to display our concat formula in an expression box on our form. We'd see this in our expression box:

    grapeorangeSome text

    Not too pretty. We can modify our formula to include some spaces!

    concat(field1, " ", field2, " Some text")

    Now we'd have

    grape orange Some text

    Mind you, the text makes no sense, but at least it is nicely formatted. For more about basic formulas and functions in InfoPath, check out this Office Online article. And this one, and this one, too.

    Hilary Stoupa

  • 12-13-2010 03:56 AM In reply to

    Re: Copy field values in Repeating Section

    Thanks Hilary,

    I have used the concat function before, but purely on text and field uses, I've not built formulas into them before.

    There were just a couple of small changes I've had to make, but for anyone interest the formula is as below

    concat("SetValue /xpath=dfs:myFields/dfs:dataFields/tns:GetFormDatasetResponse/tns:GetFormDatasetResult/ns1:dsForms/ns1:Clients[", count(preceding::Clients), "]/ns1:CustAddress1 /value=", Clients[1]/CustAddress1)

  • 12-14-2010 01:12 AM In reply to

    Re: Copy field values in Repeating Section

    On the same button, but with a different problem, I've been asked to place this button in the repeating section so it's intuitive as to what client it will work with, but I need to come up with a way of hiding the button for the first instance of my client section.

    First of all I thought the count function might work, but without succeeding, I have a feeling that doing this will just make the control disappear and then appear in ALL sections when there is more than one instance.

    Any ideas on hiding the control on the first instance and then showing it on the rest if they are created?

  • 12-14-2010 03:53 AM In reply to

    Re: Copy field values in Repeating Section

    If you hide the button when the following expression is true:

    count(preceding-sibling::repeatingGroupNode) = 0

    that should work for what you're describing.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-14-2010 05:54 AM In reply to

    Re: Copy field values in Repeating Section

    count(preceding-sibling::Clients) = 0

    Hi Jimmy,

    Thanks for your reply. I placedthe above in the expression field of the conditional formatting dialog and set it to hide the control. Unfortunately, whilst this hid the control fine, it didn't appear wen I added a second client. I tried placing the control inside and outside of the repeating section, but no change.

  • 12-14-2010 07:01 AM In reply to

    Re: Copy field values in Repeating Section

    Are you sure the field isn't actually named my:Clients or something like that?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-14-2010 08:27 AM In reply to

    Re: Copy field values in Repeating Section

    no, the repeating group is called clients.

    Data structure on page 1 if you need to see how it looks

  • 12-14-2010 08:52 AM In reply to

    Re: Copy field values in Repeating Section

    Hi:

    I still had a copy of your template on my machine. Try:

    count(preceding-sibling::ns1:Clients) = 0

    Hilary Stoupa

  • 12-14-2010 10:36 AM In reply to

    Re: Copy field values in Repeating Section

    Ha, Success.

    Thank you both very much for your help and patience. This form is very nearly finished now and I'm not sure I'd have got there without this forum.

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