apostrophe before negative values in export csv file

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

apostrophe before negative values in export csv file

Post by angus » 2023-01-08 20:57

Hi everyone, when I export a file using the csv export button i am getting an apostrophe before negative values. I have tried updating the data list here

Code: Select all

// output CSV data
		while($row = db_fetch_row($result)) {
			$prep = array_map(function($field) {
				return strip_tags(
					preg_replace(
						['/<br\s*\/?>/i', '/^([=+\-@]+)/', '/[\r\n]+/', '/"/'], 
						[' ',             '\'$1',          ' ',         '""']
						trim($field)
					)
				);
			}, $row);

			$csvData[] = '"' . implode("\"{$this->CSVSeparator}\"", $prep) . '"';
		}
by adding in

Code: Select all

['/'/', '""']
in the preg_replace
But this does not work. does anyone have any ideas?
AppGini 22.13

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: apostrophe before negative values in export csv file

Post by angus » 2023-02-23 14:02

Not sure if anyone will need this but I did get it to work. I know I am changing a central file which is not a great solution but this works for me for now.

Code: Select all

				return strip_tags(
					preg_replace(
						['/<br\s*\/?>/i', '/^([=+\-@]+)/', '/[\r\n]+/', '/"/', "/'/"], //Remove apostrophe
						[' ', 			'\'$1',	           ' ',            '',    ''],
						trim($field)
					)
				);
AppGini 22.13

Post Reply