Open-AudIT
https://www.open-audit.org/phpBB3/

Line breaks in OA Report for CSV export
https://www.open-audit.org/phpBB3/viewtopic.php?f=20&t=6686
Page 1 of 1

Author:  el_geto [ Sat Sep 15, 2018 12:02 am ]
Post subject:  Line breaks in OA Report for CSV export

Hi folks,
I'm trying to create an OA report, solely for the purpose of exporting the data to CSV, but I need some help in trying to figure out how to write line breaks in SQL, so they are passed to PHP, and ultimately as CR/LF to the CSV

SELECT service.id as 'ID', 'TechnologyService' as 'Type', service.name as 'Name',
concat('"','http://(servername)/open-audit/index.php/devices/',system.name,
'CR/LF','CR/LF',
'Service Description: ',service.description,'CR/LF',
'Service Executable: ',REPLACE(service.executable,'"',''),'CR/LF',
'Service User: ',service.user,'CR/LF',
'Service Start Mode: ',service.start_mode,'CR/LF',
'Service State: ',service.state,'"') as 'Documentation'
FROM System, Service
WHERE @filter AND system.id = service.system_id


WHERE @filter AND system.id = service.system_id

Author:  jpa [ Sat Sep 15, 2018 1:20 am ]
Post subject:  Re: Line breaks in OA Report for CSV export

If you want CR/LF I would try:
Code:
SELECT service.id as 'ID', 'TechnologyService' as 'Type', service.name as 'Name',
concat('"','http://(servername)/open-audit/index.php/devices/',system.name,
'\r\n','\r\n',
'Service Description: ',service.description,'\r\n',
'Service Executable: ',REPLACE(service.executable,'"',''),'\r\n',
'Service User: ',service.user,'\r\n',
'Service Start Mode: ',service.start_mode,'\r\n',
'Service State: ',service.state,'"') as 'Documentation'
FROM System, Service
WHERE @filter AND system.id = service.system_id


It seems that OpenAudit creates its CSV file with Line Feeds so for consistency you'd replace '\r\n' above with '\n'.

Author:  el_geto [ Sat Sep 15, 2018 2:02 am ]
Post subject:  Re: Line breaks in OA Report for CSV export

Thanks JPA that did the trick. :D

(edited my comment to hide my fqdn, would appreciate if you do the same. bots are watching :!: )

Author:  jpa [ Sat Sep 15, 2018 2:05 am ]
Post subject:  Re: Line breaks in OA Report for CSV export

Great. Copy-n-paste and search-replace so I didn't notice either.

Page 1 of 1 All times are UTC + 10 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/