Jump to content

Find and replace commas with spaces in Spotfire


Avi Levy

Recommended Posts

Hi All,

 

I hope you all are healthy in this current climate.

 

I have question I'd really like some help with: Essentially, I have a spotfire table that has many rows and columns, some of which are string. This data table will need to be exported in CSV for a different application entirely (sending surveys to recipients) and in the other program when you upload the data it needs to be in CSV.Therefore, some columns cannot have commas in them when exported from Spotfire.

The columns with commas are

Study Name

City

Site Name

Full Name

Is there a way of creating a formula that would go through each column, find the commas, and then replace them with a space or even remove them Alternatively, a calculated column that would give a "yes" for anything with a comma in the cell would be great too as I can then filter on them.

 

Example 1:

Full Name

John, Smith

 

Example 2:

Study Name:

Small Cell Lung Cancer, Oncology

 

Thanks!

Link to comment
Share on other sites

If you just have a few columns you can use either new calculated columns or the transformation option to recalculate and replace the input column. The spotfire function you are looking for is RXreplace:

RXReplace([your.column],",", " ","i")You can also use a data function that takes your entire table (df) as input and then returns a new table (df.new):

df.new

Link to comment
Share on other sites

Hi fabd,

 

Thank you so much for this quick answer (for some reason I didn't get a notification so just saw this).

 

This might be silly, but would I then have to create say 5 new calculated columns withRXReplace([your.column],",", " ","i") i.e:

Insert calculation column >RXReplace([study Name],",", " ","i") > new column with no commas. Therefore, I would have duplicates of each column, one with commas and one without

 

Cheers!

Link to comment
Share on other sites

Hi fabd, 

 

 

 

Thank you so much for this quick answer (for some reason I didn't get a notification so just saw this).

 

 

 

This might be silly, but would I then have to create say 5 new calculated columns with RXReplace([your.column],",", " ","i") i.e:

 

Insert calculation column > RXReplace([study Name],",", " ","i") > new column with no commas. Therefore, I would have duplicates of each column, one with commas and one without

 

 

 

Cheers!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...