Does Replace a Special Character With Similar Character!

Table of contents

Overview

In any kind of File Integration (Export/Import of a file) in Business Central services, it is often required for the developer to check the data before whether they contain any special characters which can lead to a wrong file generation.

So, in most of the cases, it is required to replace any special character i.e., Comma (,) or Dot(.) with space or any other character.

For example, if we need to export a CSV file from BC containing master data information or journal entries, we need to be careful about Comma (,) coming into any cell value. Otherwise, the cell will move to next because of the comma.
special-character-step1
After export,
special-character-step2
So, to replace this comma we can use a function called CONVERTSTR.
String: = CONVERTSTR (String, FromCharacters, ToCharacters)

Example:

String: = CONVERTSTR(String,’,’,’-’); Here I am replacing comma with ‘-‘

special-character-step3

The new value will be:
special-character-step4

Conclusion

That is how we can replace commas or any similar special character in a field by using this string function CONVERTSTR.

 

Read more on related Insights