I’m generating CSV data that includes URLs with multiple query parameters, so “&somekey” in them. These get serialized as “&somekey” where I want “&somekey”.
My CSV XML looks like this:
<record> <AppID>sn_admin_center</AppID> <DocsURL>=HYPERLINK(https://docs.servicenow.com/csh?topicname=admin-center-intro&version=van...)</DocsURL> </record>
I’m then doing:
let $report := csv:serialize($csv, map{}) let $doWrite := file:write('/Users/eliot.kimber/temp/apps-to-topics.csv', $report)
To write the CSV file.
The resulting file looks like:
sn_admin_center,”=HYPERLINK(“"https://docs.servicenow.com/csh?topicname=admin-center-intro&version=van...")"
Note that the “&” is still escaped.
Reviewing the docs for the CVS module and the serialize options, I don’t see any option that looks like it would control how escaping is handled.
Is there a way to do what I want?
Thanks,
E. _____________________________________________ Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.comhttps://www.servicenow.com LinkedInhttps://www.linkedin.com/company/servicenow | Twitterhttps://twitter.com/servicenow | YouTubehttps://www.youtube.com/user/servicenowinc | Facebookhttps://www.facebook.com/servicenow
file:write-text() did the trick—that did not occur to me at all.
Cheers,
E.
_____________________________________________ Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.comhttps://www.servicenow.com LinkedInhttps://www.linkedin.com/company/servicenow | Twitterhttps://twitter.com/servicenow | YouTubehttps://www.youtube.com/user/servicenowinc | Facebookhttps://www.facebook.com/servicenow
From: Christian Grün christian.gruen@gmail.com Date: Thursday, November 30, 2023 at 4:00 PM To: Eliot Kimber eliot.kimber@servicenow.com Cc: BaseX basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Generate CSV with literal "&", not "&" [External Email]
________________________________ Hi Eliot,let $doWrite := file:write('/Users/eliot.kimber/temp/apps-to-topics.csv', $report)file:write-text should do the job. An alternative is to use the serialization method 'text':file:write($path, $value, map { 'method': 'text })Hope this helps,Chr
i This message needs your attention • Someone new is on this email. Provided by ServiceNow DT (Employee Portal KB0077950) - This banner is visible only to ServiceNow employees.https://mimecast.com Hi Eliot, let $doWrite := file:write('/Users/eliot.kimber/temp/apps-to-topics.csv', $report)
file:write-text should do the job. An alternative is to use the serialization method 'text':
file:write($path, $value, map { 'method': 'text })
Hope this helps, Christian
basex-talk@mailman.uni-konstanz.de