tags:

views:

47

answers:

2

I want to use XPath code in an InfoPath form to sum the data in field12 when field11 is equal to IT. I tried using the following code, but it doesn't work.

number(sum(/descendant-or-self::node()/my:group12[my:field11 = "IT;"]/my:field12))

I suspect this has to do with the multilayering of groups, as shown below. Does anyone know the code that would allow me to get to the data in group12? Thanks in advance for your help.

myfields>group9>group10>group11>group12>field11 field12

Genipro

A: 

Looks like:

number(sum(/descendant-or-self::my:group12[my:field11 = 'IT;']/my:field12))

could be right.

Tomalak
A: 

decendant-or-self should not be necissary in this case (unless you need the expression to work even if group12 is moved).

This should work fine:

sum(/my:myfields/my:group9/my:group10/my:group11/my:group12[contains(my:field11,'IT')]/my:field12)

It doesn't matter if any of the other groups are repeating either. All group12's will be checked.

oillio