HOWTO: Concatenate two fields into one
03 Feb, 2012Posted By: John Mertic
Here’s a post from a while back in the forums:
I would like to know how can i concatenate 2 fields (fisrt_name_c and last_name_c) on the field (name) by logic_hook? And the field (name) must be on the edit form or can be append directly on the table???
Can someone teach me the code to accomplish that on the logic_hook.php
Many thanks
As you can read on that thread, there were many different ways to solve the problem with various code changes and logic hooks. However, a really fast an easy way to do this comes along with Sugar Logic, using the very handy concat function as shown below as the calculated value for the field:
concat($first_name_c," ",$last_name_c)
This will make the field instantly update-able on EditViews, and completely in sync throughout the rest of the application.