Solved

Concat Function is creating a space on some records, why?

  • 14 September 2023
  • 8 replies
  • 125 views

Userlevel 2
Badge

Hello,

I am using the following function to combine the account # with the location ID, but somehow the function is creating a space on some of the records, why?

This is the formula I am using, which is working for most of the records, however there are some that contain a space in between.

 

=Concat([BAccount.AcctCD],[Location.LocationCD])

 

Please see attached screenshot. 

 

 

Space between these records

 

icon

Best answer by darylbowman 14 September 2023, 16:02

View original

8 replies

Userlevel 3
Badge

Hi @jorgep17, you can use the Replace function in GI like this: =Concat(Replace([BAccount.AcctCD],’ ‘,’’) , [Location.LocationCD]).

Userlevel 4
Badge +2

They may be fixed width in the database, and such having the space.


You could either Trim, or replace a space with a blank.

 

=Concat(Trim([BAccount.AcctCD]),Trim([Location.LocationCD]))

or 

 

=Replace(Concat([BAccount.AcctCD],[Location.LocationCD]),’ ‘,’’)

Userlevel 7
Badge +17

@jorgep17  The reason might be that in the database, these values might be saved with the extra space.

You can use the TRIM() function to remove the space for those texts. like below.

 

=Concat(Trim([BAccount.AcctCD]),[Location.LocationCD])

 

 

Userlevel 2
Badge

Great guys,

The =Concat(Trim([BAccount.AcctCD]),Trim([Location.LocationCD])) got rid of the spaces. 

One more thing, how can I use the Replace fuction in this same formula? I need to also replace the text MAIN with 000. See below.

 

Where should I insert the Replace command?

 

=Concat(Trim([BAccount.AcctCD]),Trim([Location.LocationCD]))
=Replace([Location.LocationCD], 'MAIN', '000')

 

Badge +11
=Concat(Trim([BAccount.AcctCD]),Replace(Trim([Location.LocationCD]),'MAIN','000')

 

Userlevel 2
Badge

This one seemed to have done the trick.

Thank you all!!

 

=Concat(trim([BAccount.AcctCD]),Replace([Location.LocationCD], 'MAIN', '000'))

Badge +11

This one seemed to have done the trick.

=Concat(trim([BAccount.AcctCD]),Replace([Location.LocationCD], 'MAIN', '000'))

This is not going to trim the LocationCD.

Userlevel 2
Badge

This one seemed to have done the trick.

=Concat(trim([BAccount.AcctCD]),Replace([Location.LocationCD], 'MAIN', '000'))

This is not going to trim the LocationCD.

 

I see, maybe in my case, it didn’t need to be, as the data showed correctly after without the spaces. So I would assumed the AcctCD was the one needing Trimming. 

Thank you! 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved