Issue with a comma in the name of software when exporting to csv

(imported topic written by dspence91)

I have a custom report that I have scheduled to email me every week as a csv file. Unfortunately, one of the software names that gets returned is ‘Microsoft Office 97, professional edition’. Since it has a comma in the name of the software and I’m exporting to csv, it creates a new column in the report. How can I exclude that comma or replace it in the report? Here’s my code:

<?Relevance concatenation "%0d" of (name of it & "," &((if (it = "") then "n/a" else it) of concatenation ";" of unique values of values whose (it as lowercase starts with "microsoft office 97" AND it as lowercase does not contain "trial") of it & "," & (if (it = "") then "n/a" else it) of concatenation ";" of unique values of values whose (it as lowercase starts with "microsoft office visio professional 2007" AND it as lowercase does not contain "trial") of it & "," & (if (it = "") then "n/a" else it) of concatenation ";" of unique values of values whose (it as lowercase starts with "microsoft office visio standard 2007" AND it as lowercase does not contain "trial") of it & "," & (if (it = "") then "n/a" else it) of concatenation ";" of unique values of values whose (it as lowercase starts with "microsoft office project standard" AND it as lowercase does not contain "trial") of it) of (result (it, bes property "Installed Applications - Windows"))) of bes computers whose (length of name of it > 0 and exists (value of result (it, bes property "Installed Applications - Windows")) ) ?>

(imported comment written by BenKus)

Hi dspence,

Here is a general purpose way to replace characters in relevance:

In this case “,” are replaced with “;;”:

(concatenation “;;” of substrings separated by “,” of it) of ()

For instance:

q: (concatenation “;;” of substrings separated by “,” of it) of (“abc”;“a,b”;“a,b,c” )
A: abc
A: a;;b
A: a;;b;;c

Ben

(imported comment written by dspence91)

Thanks Ben. I ended up taking a simple approach and since it was only one piece of software that had a comma in it, I moved it to the end so I can just ignore the last column because it’s unnecessary information.

(imported comment written by Edj)

Ben,

Thanks, it worked for me. That was pretty cool.

Ed