Solved

Trim starting string in acumatica


Userlevel 4
Badge

Hi Team,

I want to Trim the starting characters from a field in acumatica. I tried using “Split” function, but it is not working as expected.

Please help me on this.

 

 

Sample code:

 

Regards,

Ramya

icon

Best answer by NageswaraRaoAddanki60 6 May 2022, 07:55

View original

6 replies

Userlevel 7
Badge +11

Hi @ramya15 

You need to split with a front slash (\) and get the list. Then You can eliminate the first record and use the second one. Adjust the code as per your requirement.

 

Sample:
string[] values = row.Name?.Split('\,');

 string value = values.Length > 1 ? values[1] : string.Empty;
                

Userlevel 7
Badge +17

Hi @ramya15  

Hope you are doing well!

You can use the normal C# code to substring based on the slash character. Please find the line below for reference.

 

https://stackoverflow.com/questions/1857513/get-substring-everything-before-certain-char

 

hope this helps!

Userlevel 2
Badge

Hi @ramya15 

You can use this in your solution, may be  it will help you for splitting (\) slash.

string value = @"Report Log(7 RL-000007)\SPYTL FRD Timecard V03-signed";
          value = value.Split('\\')[1]; 

 

Thank you..!

Userlevel 4
Badge

Hi @Naveen Boga/ @jinin 

Thanks for the response. hope you are doing well!!

I’m facing one more problem escape character ‘\’.  could you please help me yo rectify.

 

 

Userlevel 4
Badge

Thanks @Naveen Boga\ @NageswaraRaoAddanki60 \ @jinin 

 

after using “\\” it is working.

 

Regards,

Ramya

Userlevel 7
Badge +17

Awesome @ramya15  Thanks for sharing the update.

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