if all fields are empty calculation
In FM Pro 12 How can I make a calculation to retrieve an error message in a layout when all fields are empty (I am using popup menus) ?
Any help would be great appreciated
LOL, your opening was wanting "if all fields are empty calculation" :-)
If you wish to know if ANY field was left empty the fasted calculation would be:
If [ Count ( TableA::FieldA ; TableA::FieldB ; TableA::FieldC ) <> 3 ]
... but to answer your question about TableA::FieldA] = "" ... no, it is not a good way to determine if a field is empty. That is what IsEmpty() is normally used for. However, a field is only counted if it has a value so we can take advantage of that fact and use Count() which is faster than even the IsEmpty() test (and easier to write).
BTW, those brackets aren't needed at all except when typing a script-step and indicating the brack for it. But the calc needs no brackets/
The quickest would be something like:
Count ( field1 ; field2 ; field3 )
... Any number returned means at least one field is not empty. :-)
So now create a text object called ERROR and make it red. Create a formula =
not Count ( field1 ; field2 ; field3 )
... and below go to more options and set the font size to custom and 500 pt. ERROR will disappear when there are no values.
I wrote something like
If [TableA::FieldA] = "" and [TableA::FieldB] = "" and [TableA::FieldC] = "" and [TableA::FieldD] = ""]
Show Custom Dialog ["Error Message"; "One of the fields is empty"]
For me it worked, but is it correct what I did?
It worked. Thank you!
what does >< 3 do??? Sorry for my ignorance but I am new to FM.
'Does not equal'
I was typing from iPad and there is no 'equal with line through it' but FM recognizes <> as well. And of course the 3 is the number of fields you include in the count. You could also use < 3 (less than 3). :-)
Retrieving data ...