-Lisa- Posted August 16, 2017 Share Posted August 16, 2017 Anyone know of a way to add a space between all characters of a field? I have a numeric field where a space is required between each and every character. It's a Zip Code field so the majority of the records will contain five digits. Thanks! Quote Link to comment Share on other sites More sharing options...
GreggRusson Posted August 16, 2017 Share Posted August 16, 2017 Put this into a rule: var ZipWithSpaces = ""; for(var idx = 0; idx < Len(Field("ZIP")); idx++) { ZipWithSpaces += Field("ZIP").substr(idx,1) + " "; } return Trim(ZipWithSpaces); Gregg Quote Link to comment Share on other sites More sharing options...
-Lisa- Posted August 16, 2017 Author Share Posted August 16, 2017 Worked like a charm! Thanks so much, Gregg! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted August 16, 2017 Share Posted August 16, 2017 return Field("ZIP").split('').join(' '); Quote Link to comment Share on other sites More sharing options...
tou Posted August 17, 2017 Share Posted August 17, 2017 Do you need the actual spaces? If not, you can play with the tracking to "expand" or condense the spacing to mimic the coding........ Quote Link to comment Share on other sites More sharing options...
GreggRusson Posted August 18, 2017 Share Posted August 18, 2017 To Dan, Great response, clear, concise and compact. To Tou, After posting my 'down and dirty' response, I had the same thought on tracking tags. It wasn't clearly defined 'why' the extra space was needed, but you're right. If there was a reason the spacing between the characters needed some kind of exacting tolerance, that would have been the way to go. Gregg Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.