I have the following XPath 1.0 expression in MS InfoPath (I will post accompanying XML):\[code\]//my:Value_Modifier_Group[1=count(following-sibling::my:Value_Modifier_Group)]//my:Modified_Start_Value[(text())] | //my:Start_Value[text() and not(//my:Value_Modifier_Group[1=count(following-sibling::my:Value_Modifier_Group)]//my:Modified_Start_Value[(text()])]\[/code\]If there is an initial value and no "Modified Value" yet then the initial value is returned. If a modified value is present then it is returned.I need to return that value and then perform the following operations on it:\[code\]number(//my:Value_Modifier_Group[1=count(following-sibling::my:Value_Modifier_Group)]//my:Modfied_Start_Value) + number(//my:Value_Modifier_Group[0=count(following-sibling::my:Value_Modifier_Group)]//my:Start_Value_Increase) - number(//my:Value_Modifier_Group[0=count(following-sibling::my:Value_Modifier_Group)]//my:Start_Value_Decrease)\[/code\]This operation adds or subtracts an increase/decrease value. The problem is that this expression returns a NaN if no \[code\]Modified_Start_Value\[/code\] is present. Works great otherwise.I need to team both of these expressions together into a single XPath expression.
- If \[code\]Modified_Start_Value\[/code\] has a preceding value, use that in operations
- If \[code\]Modified_Start_Value\[/code\] does not have a preceding value then use \[code\]Start_Value\[/code\] in operations instead
- It is important that I always use the "preceding" value because the preceding value is fixed. It acts as a reference point or starting point.