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

浪子不回头ぞ 提交于 2019-12-24 00:48:59

问题


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 the 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! :-)


回答1:


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.




回答2:


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)



来源:https://stackoverflow.com/questions/2068139/using-isempty-function-in-a-filemaker-pro-v9-calculation-with-multiple-fields

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!