Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If Then Else in Infopath (Xpath): how to ?

Tags:

sharepoint

I've a module in InfoPath / Sharepoint, a query field, and some fields. I want to perform in formula a simple :

If (Condition) then
   True Condition
Else 
   False Condition

In particular I want to write this formula:

If (FieldA = "") then Get FieldB else Get FieldA

How to do in InfoPath formula ?

Thanks

like image 305
stighy Avatar asked Aug 03 '17 13:08

stighy


1 Answers

If you want to use this as a default value, you can simply use the conditional default values. Therefor just use the following snippet:

(TrueResult | ElseResult) [(BoolCondition) + 1]

And in your case:

(FieldA | FieldB) [(string-length(FieldA) > 0) + 1]

For more information on this see: https://blogs.msdn.microsoft.com/infopath/2006/11/27/conditional-default-values/

like image 144
kpalatzky Avatar answered Oct 08 '22 01:10

kpalatzky