Jump to content
  • 0

How to remove duplicate characters from a string


Question

Hi,

I have several fields in the table with the Text(255) data type and need to concatenate these values in the Formula field as comma-separated values.

The formula is simple as looks like this:

hZ9PISx.png

The issue is that in some records some vales are blank an the output has extra commas:

OXA6UkY.png

How to remove them?

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

 Just sharing the solution in the Question&Answer way. Maybe it is helpful for some forum members.

This formula helped to remove extra commas from the string:

REPLACE(LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(REPLACE(([@field:field_1] + ',' + [@field:field_2] + ',' + [@field:field_3] + ',' + [@field:field_4] + ',' + [@field:field_5]), ',', '><'), '<>', ''), '><', ','), ',', ' '))), ' ', ',')

The output is the following (Formula_1 field):

JLMcbG4.png

 

Link to post
Share on other sites
  • 0

Thank you for sharing this @CoopperBackpack!

I have been trying to utilize this formula on the DataPage as well, however seems that there are some limitations and it works in the Table formula only. 

Here is alternative SQL formula that I have found. It can be used in a Calculated field/value on the DataPage:

COALESCE( NULLIF([@field:A],''), '') + COALESCE(', ' + NULLIF([@field:B],''), '') + COALESCE(', ' + NULLIF([@field:C] ,''), '') + COALESCE(', ' + NULLIF([@field:D],''), '')
image.png


Regards

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...