chadski021 Posted June 24, 2014 Posted June 24, 2014 Hello, Can Someone help me i have a merge code lets say i have 3 fields firstname, middlename and last name and i have a substitute field to put this 3 field Substitute ( Self ; [ "<<firstname>>" ; table::firstname ] ; [ "<<middlename>>" ; table::middlename ] ; [ "<<lastname>>" ; table::lastname ] ; ) and i put this on this substitute field for example My name is <<firstname>> <<middlename>> <<lastname>> My problem is if the <<middlename>> is empty it leaves a space is there a way to remove the space without actually removing the <<middlename>> on the center?
comment Posted June 24, 2014 Posted June 24, 2014 You could either add the spaces conditionally, based on the result of IsEmpty ( middlename ) - or attack the problem globally, using the TrimAll() function.
Lee Smith Posted June 24, 2014 Posted June 24, 2014 Simple answer would be FirstName & “ “ & MiddleName & “ “ & LastName assuming all fields are not empty? Most of the time the data in the fields are not always that clean. This would probably work for you // Trim removes and leading and trailing spaces. Substitute removes the extra spaces if there is no middle name. Trim( Substitute( Title & " " & First & " " & Middle & " " & Last; [ " "; " " ]; // Remove 2 spaces [ "¶"; "" ] // Remove extra carriage returns ) )
David Jondreau Posted June 26, 2014 Posted June 26, 2014 I like List() and Substitute(). Let( [ first.name = Substitute ( Self ; "<<firstname>>" ; table::firstname ) ; middle.name = Substitute ( Self ; "<<middlename>>" ; table::middlename ) ; last.name = Substitute ( Self ; "<<lastname>>" ; table::lastname ) ; result = Substitute ( List ( first.name ; middle.name ; last.name ) ; "¶" ; " " ) ]; result )
Recommended Posts
This topic is 4140 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now