如果那么在Infopath(Xpath):怎么样?

sti*_*ghy 7 sharepoint

我在InfoPath/Sharepoint中有一个模块,一个查询字段和一些字段.我想在公式中执行一个简单的:

If (Condition) then
   True Condition
Else 
   False Condition
Run Code Online (Sandbox Code Playgroud)

特别是我想写这个公式:

如果(FieldA ="")则获取FieldB否则获取FieldA

如何在InfoPath公式中做?

谢谢

arc*_*hos 4

如果您想使用它作为默认值,您可以简单地使用conditional default values. 因此只需使用以下代码片段:

(TrueResult | ElseResult) [(BoolCondition) + 1]
Run Code Online (Sandbox Code Playgroud)

在你的情况下:

(FieldA | FieldB) [(string-length(FieldA) > 0) + 1]
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参阅: https://blogs.msdn.microsoft.com/infopath/2006/11/27/conditional-default-values/