AnsweredAssumed Answered

Calculation field not working properly.

Question asked by rolycat on Oct 3, 2018
Latest reply on Oct 5, 2018 by beverly

Hi,

 

I have just joined the FM Community in the hope that someone can help me with a minor problem that has me stumped.  I am very much at the beginner level, so I would ask that any answer I may receive is put in very simple, step-by-step terms; please do not assume knowledge!!

 

I am attempting to upgrade a database I cobbled together for my partner's home business several years ago and as such am focusing on areas to improve in bite-size chunks.

 

The table occurrence I am currently focusing on is the Customer table.  It includes the following fields:

 

kp_CustomerID

FirstName

LastName

CompanyName

c_FirstNameLastName  =  FirstName & " " & LastName

c_FullName  =  If ( IsEmpty ( CompanyName ) ; c_FirstNameLastName ; CompanyName)

 

On the Customer layout, in the Header, I have a merge field c_FullName which displays the name of the individual or the business (depending on which fields have been filled out) on the record.

 

When I click on Filemaker's "New Record" button, everything works perfectly.

 

Rather than entering a new customer via this method, I created a popover in which to add a new customer to the database with the following global fields:

 

g_FirstName

g_LastName

g_CompanyName

 

I have an "Add New Customer" button on the popover which runs the following script:

 

New Record/Request

Set Field [ Customer::FirstName ; Globals::g_FirstName ]

Set Field [ Customer::LastName ; Globals::g_LastName ]

Set Field [ Customer::CompanyName ; Globals::g_CompanyName ]

Commit Records/Requests [ With dialog: On ]

Set Field [ Globals::g_FirstName ; " " ]

Set Field [ Globals::g_LastName ; " " ]

Set Field [ Globals::g_CompanyName ; " " ]

Commit Records/Requests [ With dialog: On ]

 

This also works fine.  However the merge field c_FullName, in the Header, is no longer working properly if I enter a new customer via the popover.  If the new customer entered is a business name, i.e. a name entered into g_CompanyName, the c_FullName merge field in the Header displays the business's name.

 

If the new customer entered is an individual, i.e. g_FirstName and g_LastName fields are filled in, the c_FullName merge field in the header does not display anything.

 

I suspect there is something that needs adding into the script, but as my (steep) learning curve involves a lot of copying and adapting other users' solutions, I really am unsure of how to fix this issue, so any help would be greatly appreciated and hopefully I will gain another little piece of understanding of how Filemaker works, in the process!

 

I hope my explanation is clear.

 

Thank you.

Outcomes