开发者

Using IsEmpty function in a filemaker Pro (v9) calculation with multiple fields

I want to write a simple calculation to return a value based on a heirarchy of fields.

If the first field is empty, I want it to return the second, and if the second is empty, the third. I have tried the following but it only returns t开发者_StackOverflow社区he first value.

If (IsEmpty (Field1 = 1) ; Field2;
If (IsEmpty (Field2 = 1); Field3; Field1))

I was able to get the first or third value to appear by using:

If (IsEmpty (Field1) &
If (IsEmpty (Field2); Field3; Field1))

But of course this doesn't show the Field2 at all.

Is there something along the lines of:

If (IsEmpty (Field1) &
If (IsEmpty (Field2); Field3; Field1, Field2))

which I can use? This obviously doesn't work because there are too many parameters in the function.

Any help would be very much appreciated! :-)


You need to nest your calc a bit more :

Case ( 
IsEmpty ( Field1 & Field2 ) ; Field3 ;
IsEmpty ( Field1 ) ; Field2 ;
Field1
)

In your examples, you had IsEmpty (Field1 = 1) which will test Field1=1, which is either True or False, but never empty. And the & is a concatentation operator, if you're wanting logical and then use and instead.


You could rewrite this in a more transparent way:

Case(
    not isEmpty(Field1); Field1;
    not isEmpty(Field2); Field2;
    Field3
)

(this would be much easier to maintain/read in the future)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜