Possible to reference the value of a field in a group (x) whose name matches a string (y)? - InfoPath Dev
in

InfoPath Dev

Possible to reference the value of a field in a group (x) whose name matches a string (y)?

Last post 10-15-2013 07:34 AM by mauledbyjesus. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-09-2013 12:02 AM

    Possible to reference the value of a field in a group (x) whose name matches a string (y)?

    Infopath2010 - Is there a way to set the value of "field3" to the value of the(or a) field in "group1" whose name matches the value of "field2" in the following scenario?

    • Data connection: data
      • Group: group1
        • Field: field1
          • Value: 1
        • Field: field2
          • Value: "field1"
        • Field: field3
          • Value: NULL
     
    I'm trying to do some on-the-fly addition based on what users are choosing from 4 different controls. The value of each potential choice is already stored in a group of fields. A formula/filter that could reference them dynamically would allow me to use a single rule instead of 12. Wishful thinking?
    Filed under: , ,
  • 10-09-2013 07:14 AM In reply to

    Re: Possible to reference the value of a field in a group (x) whose name matches a string (y)?

     Maybe I need more information on the types on controls and data you are trying to add up.

     Yet in field3 why not set its default value to field1+field2 ? 

     I did a test where by all 3 fields: field1, field2 and field 3 were text fields.

    Field 3 equalled field1+field2

  • 10-09-2013 08:44 AM In reply to

    Re: Possible to reference the value of a field in a group (x) whose name matches a string (y)?

     Fun! See attached sample. Enter the name of a field (field1, field3, field4) in the top text box and the value should show up in the bottom text box.

    Hilary Stoupa

  • 10-09-2013 01:08 PM In reply to

    Re: Possible to reference the value of a field in a group (x) whose name matches a string (y)?

    Thanks for the replies everyone! The sample logic works exactly as I needed! In porting it, everything works when all fields are all in the same group.
     
    How would I need to alter *[local-name(.) = field2]  to explicitly define a group to check for a field that matches the value of "field2"? In my case, field2, field5, and field1/3/4 are in different groups on the same data connection. 
     
    My connection layout using your example fields:
     
    • ui (group)
      • field2
      • QAItemCounts (group)
        • Role (group)
          • field1
          • field3
          • field4
        • field5
  • 10-10-2013 07:17 AM In reply to

    Re: Possible to reference the value of a field in a group (x) whose name matches a string (y)?

    ../my:Role/*[local-name(.) = ../../../my:field2] I think....

    Hilary Stoupa

  • 10-15-2013 07:34 AM In reply to

    Re: Possible to reference the value of a field in a group (x) whose name matches a string (y)?

    So close I can feel it! :D

    I get an "a number is required" error when validating the formula. I presume it is trying to perform a multiplication operation because of the asterix?

    I was missing an end slash after Role.
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.