Solved

How to split a field description into new lines based on a regx in the detail section of a report?

  • 3 April 2024
  • 4 replies
  • 50 views

Userlevel 4
Badge

Can i know how to split the below description which is come in a Descr field as shown in below intended output. 

Value of the field:1. 1x GP- 39 Display Unit 2. 1x GPA -CO1 Antenna Unit with 10m Cable 3. 1x MU A25PF0017 Power Data Cable *2m2* 4. 1x Std Installation materials and spare parts 5. 1x Operational Manual

Intended Output:

1. 1x GP- 39 Display Unit

  2. 1x GPA -CO1 Antenna Unit with 10m Cable

  3. 1x MU A25PF0017 Power Data Cable *2m2*

  4. 1x Std Installation materials and spare parts

  5. 1x Operational Manual

 

Please check the below image.

 

icon

Best answer by lauraj46 4 April 2024, 13:45

View original

4 replies

Userlevel 7
Badge +7

Hi @malinthawarnakulasooriya08 ,

Text fields in the Report Designer support HTML.  You could use the replace function to replace your regular expression with an html line break, something like this:

=replace([InventoryItem.Desc],’1x ‘, ‘<br>’)

I believe ConvertHtmlToText should be False, which is the default.

 

Hope this helps!

Laura

Userlevel 4
Badge

Thank you so much @lauraj46 .I tried it, but it is hard to get the intended output as below.

Intended Output

  1. 1x GP- 39 Display Unit

  2. 1x GPA -CO1 Antenna Unit with 10m Cable

  3. 1x MU A25PF0017 Power Data Cable *2m2*

  4. 1x Std Installation materials and spare parts

  5. 2x Operational Manual

I used the below function.

=IIf([CROpportunityProducts.UsrAddItemDescription] <> null, Replace( [CROpportunityProducts.UsrAddItemDescription], '. ','{br}' ), '')
Userlevel 7
Badge +7

Hi @malinthawarnakulasooriya08 ,

Sorry, I didn't notice the line numbers in your example.  Is there a limit as to how many line numbers will be in the description?  You could try something like this:

=IIf([CROpportunityProducts.UsrAddItemDescription] <> null, Replace(Replace( [CROpportunityProducts.UsrAddItemDescription], '2. ','{br}2. ' ), ''),'3. ',{br}3. ')

Repeat the nested Replace for each possible row number.

Hope this helps!

Laura 

Userlevel 4
Badge

Thank you so much @lauraj46 for the valuable guidance.

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