Overview: Special Character With Similar Character
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.
After export,
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 ‘-‘
The new value will be:
Conclusion
That is how we can replace commas or any similar special character in a field by using this string function CONVERTSTR.