9 Replies Latest reply on Jun 30, 2017 5:00 PM by bigtom

# Just bought FMP16 yesterday. Are new to it but are enjoying it.  Question: Formula. If 'a' is filled & 'b' is filled then add 'a' & 'b'. If not, leave as found. Please help. Awaiting your response. Thanks

Just bought FMP16 yesterday. Are new to it but are enjoying it.

Question: Formula. If 'a' is filled & 'b' is filled then add 'a' & 'b'. If not, leave as found.

• ###### 1. Re: Just bought FMP16 yesterday. Are new to it but are enjoying it.  Question: Formula. If 'a' is filled & 'b' is filled then add 'a' & 'b'. If not, leave as found. Please help. Awaiting your response. Thanks

c = Case( not IsEmpty( a ) and not IsEmpty( b ); a & b; c )

• ###### 2. Re: Just bought FMP16 yesterday. Are new to it but are enjoying it.  Question: Formula. If 'a' is filled & 'b' is filled then add 'a' & 'b'. If not, leave as found. Please help. Awaiting your response. Thanks

And Welcome to FM Community forum, BTW!

Beverly

1 of 1 people found this helpful
• ###### 3. Re: Just bought FMP16 yesterday. Are new to it but are enjoying it.  Question: Formula. If 'a' is filled & 'b' is filled then add 'a' & 'b'. If not, leave as found. Please help. Awaiting your response. Thanks

Or he could mean add "a" and "b" as in addition of two numbers such as:

If ( Not IsEmpty ( A ) and Not IsEmpty ( B ) ; A + B )

Wasn't sure by the question if he meant concatenating like bigtom shows or addition.

• ###### 4. Re: Just bought FMP16 yesterday. Are new to it but are enjoying it.  Question: Formula. If 'a' is filled & 'b' is filled then add 'a' & 'b'. If not, leave as found. Please help. Awaiting your response. Thanks

Taylor Sharpe wrote:

Wasn't sure by the question if he meant concatenating like bigtom shows or addition.

The OP might be a Victoria ...

• ###### 5. Re: Just bought FMP16 yesterday. Are new to it but are enjoying it.  Question: Formula. If 'a' is filled & 'b' is filled then add 'a' & 'b'. If not, leave as found. Please help. Awaiting your response. Thanks

Welcome to the community. As you see, we are not sure we understand what you are trying to ask. Several of our colleagues have offered you answers that you should look at.  I thought, however, I might offer a couple FileMaker 101 tips, in the form of an FAQ.

.

### How do you know if a field is empty or not?

Use the IsEmpty() function. For example,

`IsEmpty ( PERSONS::CompanyName )`

If the selected record was for a person with my name ("William Porter") that would return 1 if the company name field for William Porter was empty or 0 if the company name had a value in it. NOTE that "empty" means TOTALLY EMPTY. Occasionally a field gets a space or a return in it, and it LOOKS empty, but to FileMaker, it's not.

If you prefer, or when you need to, you can add "Not" in front of the IsEmpty() function to turn its result around. So Not IsEmpty( PERSONS::CompanyName ) returns 1 if there's a value in that field, and 0 if it's empty.

.

### How do you know if both of two fields are empty?

You have to ask separately about each field, and connect your questions with the logical operator "and".

`IsEmpty ( PERSONS::FirstName ) and IsEmpty ( PERSONS::LastName )`

"A and B" only returns the result 1 (true) if both A and B are true.

.

### What's the difference between "&" operator and "+" operator?

The ampersand or "&" operator is used for joining bits of text together. The plus-sign ("+") operator is used to add numbers together.

`"whipped" & " " & "cream"` returns "whipped cream".

`19 + 7` returns "26" (a number result).

Note that in the "whipped cream" example, I was also concatenating a space, in between the two words.

.

### Practical examples?

Here are a couple of practical examples.

`Case ( `

`   not isempty ( PERSONS::LastName ) and Not IsEmpty ( PERSONS::FirstName ) ; `

`   PERSONS::FirstName & " " & PERSONS::LastName ;   `

`   "Name Incomplete!" ;   `

`   );   `

So if FirstName = "Thomas" and LastName = "Jefferson", then this calculation would return "Thomas Jefferson". If either name was missing, the formula would return, "Name Incomplete!"

And here's a math example. This formula might be used to calculate the value for a field called INVOICES::TotalPayable.

`Case ( Not IsEmpty ( INVOICE::LineItemsTotal ) and IsEmpty ( INVOICE::TaxToPay ) ;`

`   Invoice::LineItemsTotal ; `

`   Invoice::LineItemsTotal + INVOICE::TaxToPay )`

This calc assumes that there will be a valud in 'TaxToPay' if there is, um, tax that needs to be paid. :-)

.

### What happens if you use & to join "4" and "7"?

You'll get "47". The & operator will assume the things it is joining are text items.

.

### What happens if you use + to add "whipped" and "cream"?

If you're working in FileMaker Pro Advanced, open up the DataViewer, switch to "Watch", and try it for yourself! If you don't have Advanced, create a temporary calculation field and put that exact formula in it, namely,

`"whipped" + "cream"`

If you do this in the formula for a calc field, you'll have to specify whether the result should be a text value or a number value. Try it both ways and see what happens.

Welcome to the Community and to FileMaker!

1 of 1 people found this helpful
• ###### 6. Re: Just bought FMP16 yesterday. Are new to it but are enjoying it.  Question: Formula. If 'a' is filled & 'b' is filled then add 'a' & 'b'. If not, leave as found. Please help. Awaiting your response. Thanks

Thanks william for your help and responses.

You have helped us over that hurdle.

I am now working on:

If 'a' and 'b' are filled then put the date (todays; modifiable) in 'c'.

We will try to use all the help that you have already sent our way.

Thanks again for now, Victor

On Thu, Jun 29, 2017 at 6:45 PM, William-Porter <wp@rucksack-texnology.com>

• ###### 7. Re: Just bought FMP16 yesterday. Are new to it but are enjoying it.  Question: Formula. If 'a' is filled & 'b' is filled then add 'a' & 'b'. If not, leave as found. Please help. Awaiting your response. Thanks

Can I suggest that you invest some time working through the two excellent Training documents now freely available from FileMaker themselves. They really are great and will teach you how to use the product to a decent level.  They are for FileMaker 15 but don’t worry about that - the core is the same.

Good luck.

1 of 1 people found this helpful
• ###### 8. Re: Just bought FMP16 yesterday. Are new to it but are enjoying it.  Question: Formula. If 'a' is filled & 'b' is filled then add 'a' & 'b'. If not, leave as found. Please help. Awaiting your response. Thanks

With all the responses that I received, I was able to get that done.

I have also read and tested many other option but cannot put a handle on this one:

Got a coupon in A field, and when it is used; a check mark in B field; when A & B are 'filled' I wanted the current date to appear in C field.

Q2: How can I formulate this one?

• ###### 9. Re: Just bought FMP16 yesterday. Are new to it but are enjoying it.  Question: Formula. If 'a' is filled & 'b' is filled then add 'a' & 'b'. If not, leave as found. Please help. Awaiting your response. Thanks

Auto-enter calc: Case( not IsEmpty(B); Get(CurrentDate); "")

1 of 1 people found this helpful