Exporting from pgadmin reads line breaks in field cells and creates unreadable Excel - line-breaks

I'm new to this, so I am sure it is a silly question, but I have read through every question related on the site and can't find anything!
I am exporting from pgadmin. A few of the columns have line breaks within the cells, so the exported data is very choppy. Does anyone know how to fix this? Is there a way to make it so the line breaks within cells are not read?
I know I am doing the right settings for exporting, but basically what happens is that the header names are there, along with one row of content for each column and then Column A will have 20 more rows beneath it because of line breaks from the first cell in column E.
Any help would be much appreciated!

I assume that you're referring to the Query --> Execute to file command in the Query window. I don't think it's a bug that pgAdmin doesn't escape line breaks within strings in its csv output, but Excel can read it correctly anyway.
In the export options, please make sure that you use commas as column separators and double quotes as quote chars. Here are my settings:
Additionally, when you load your CSV into Excel, please don't use Data -> From Text. This one doesn't parse CSV with line breaks correctly. Just open the file directly in Excel (via Open within Excel, or by right clicking it in Windows Explorer and choosing Open With -> Microsoft Excel).

Related

Google BigQuery EXPORT DATA csv file on storage - issue special characters write badly

I need to export data of a BigQuery table into csv on Google Cloud Storage.
I used the following:
EXPORT DATA
OPTIONS(
uri=concat(path_file_output,'_*.csv'),
format='CSV',
overwrite=true,
header=true,
field_delimiter=';'
)
AS
SELECT * FROM my_bigquery_table
In my_bigquery_table there are string columns with the character '€' that are badly changed during the export
for example: a field with '1234.56 €' is changed with '1234.56 â'.
Exist a way to avoid this?
on the google documentation :https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements
there aren't any other options for the export
Microsoft will be always Microsoft... Be reading the comments, the problem comes from Excel, and the default encoding format.
So, let me explain. Your system doesn't use a UTF-8 encoding format. In France, my system uses ISO8859 encoding type, and when you open a file with Excel, it doesn't understand. Same thing if you have a coma separated value (the meaning of CSV) that you import in Excel, it doesn't work in France (we have the habit to use semi-colon separated value).
Anyway. There isn't straight forward solution to open the file with Excel. But you can do it.
Open Excel, and open a blank notebook
Go to Data, Get Data, from text
Select your file and click on "get data"
Then you can configure your import. Select UTF-8 as File Origin
And then continue with other parameters. You can see a sample of your file and the result that you will get.
Note: I have nothing against microsoft, but when it comes to development, Microsoft is a trap nest...

Oracle Apex SQL Workshop - New line(CHR10) not working in varchar DB column

I need to display text with line breaks in email.
The source database column has datatype varchar2(1000).
However in sql workshop, when i update it using CHR(10), it does not introduce line breaks and the output comes in single line. Even in application/email body, its showing as single line.
update text set text_content='Life'
||CHR(10)
||CHR(10)
'The very essence';
The output is simply: Life The very essence.
Instead of:
Life
The very essence.
How can i introduce line breaks?
Apex version : 20.1
SQL Workshop is not a good way to determine the line break is there. It is an invisible character and in SQL Workshop you can't see it.
Run the following code
WITH mydata (c)
AS
(
SELECT 'Hello'||chr(10)||'world' FROM DUAL
)
SELECT
c,
REPLACE(c,chr(10),'X')
FROM mydata;
That shows that the line break is there.
To make it visible in email, the best way is to replace the chr(10) with a <br> tag since email is usually sent in html. You can also use css classes as explained in this question

Upload and parse file in Oracle APEX

I'm trying to find the best way to upload, parse and work with text file in Oracle APEX (current version 20.1). Bussiness case: I must upload text file, first line will be saved to table A.
Rest lines contains some records (columns are pipe delimited) should be validated. After that correct recordes should be saved to table B or if there is some error it should be saved to table C (error log).
I tried to do something with the Data Loading wizard but it doesn't fit to my requirements.
Right now I added a "File browse..." item to page, and after page submit I can find this file in APEX_APPLICATION_TEMP_FILES in blob_content.
Is there any other option to work with that file than working with blob_content from APEX_APPLICATION_TEMP_FILES. I find it difficoult to work with type of data.
Text file look something like that:
2020-06-05 info: header line
2020-06-05|columnAValue|columnBValue|
2020-06-05|columnAValue||columnCValue
2020-06-05|columnAValue|columnBValue|columnCValue
have a look into the APEX_DATA_PARSER.PARSE table function. It parses the CSV file and returns the values as rows and columns. It's described in more detail within this blog posting:
https://blogs.oracle.com/apex/super-easy-csv-xlsx-json-or-xml-parsing-about-the-apex_data_parser-package
Simply pass "file.csv" (literally) as the p_file_name argument. APEX_DATA_PARSER does not care about the "real" file name....
The function uses the file extension only to differentiate between delimited, XLSX, XML or JSON files. So simply pass in a static file name like "file.csv". That should be enough.

Split attribute labels with delimiter for processing

I opened a csv file in Weka 3.8 and selected an attribute/column (picture below). The labels are delimited by a pipe character. There should be 23 distinct labels but Weka displays 914. Thus, Weka cannot visualize for too many values. Action is one label, adventure is another one, etc. Basically there can be more than one label per row.
For processing (eg. classification), How can separate those values so Weka can read them?
This question is similar to this. But the question asks about the date attribute (eg. "dd-MM-yyyy HH:mm"). This asks about a character-separated value (eg. "Action|Adventure|Drama")
Edit:
The data is taken from kaggle.
Ah, I had run into this problem too.
Firstly, ensure that the Genres attribute is recognised as a String type. If you are only using the GUI, go to Open File... and open the file (I presume it's a .dat file. If you've renamed it to .csv hit the check box which says "Invoke options dialog").
In the Generic Object Editor window, enter the index of the Genres attribute (here it's last).
Doing that will cause the attribute to look like this in the GUI.
Now choose the filter called StringToWordVector (weka.filters.unsupervised.attribute.StringToWordVector). Now under the Editor window, find the Tokenizer entry, click on its field, and under delimeters remove the defaults and add the pipe character. You may optionally edit the attribute prefix field as well.
Hit apply and find the required genres added in as numeric attributes, set to 0 for cases where the genre was not present in the original string, 1 otherwise.
StringToWordVector is a pretty useful filter, and there's much more to it in the docs: http://weka.sourceforge.net/doc.dev/weka/filters/unsupervised/attribute/StringToWordVector.html.

SP 2013 - Quick edit with Managed Meta Data columns, copy and paste from excel

I'm trying to migrate a meta data from an excel spreadsheet to a SP 2013 document library. The columns are managed meta data columns with pre defined terms matching the data in the excel spreadsheet.
However I cannot copy and paste data from excel via Quick Edit in the doucment library without getting the following error "The data returned from the tagging UI was not formatted correctly"
This happens even when I remove all formatting or paste to notepad first.
Are there any simple solutions to this issue?
http://i.imgur.com/1bqpMPA.jpg
Thanks,
Any metadata fields are in fact foreign keys, as it were, to a dynamic, hidden table (or 'list', whatever you want to call it) within SharePoint. To paste a value into a metadata column, you need to know your element's guid (as in, within the term set) and then append that to each metadata element you're pasting in as a <name>|<guid> pair.
Getting the GUID for an element within your term set
Browse to [site-root]/TaxonomyHiddenList/AllItems.aspx and create a new view (or edit the default one) to display the field 'IdForTerm'.
Where you have a term 'apple', your IdForTerm may look like '1288beaf-82e0-4d81-b9de-ad5ad8382938'. Take a note of the guid for each term which appears within your input data.
Edit your input to correctly reference each term
Let's say you're importing your data from an Excel spreadsheet. Or from a CSV. It doesn't really matter. What you need to do is, basically, a find and replace down each managed metadata column, replacing 'term' with 'term|guid'. So our example from earlier, with the apple, would become 'apple|1288beaf-82e0-4d81-b9de-ad5ad8382938'.
Finally, assuming your view is set up in exactly the same order as your input data, you should be able to 'edit list' from within the browser, hit the leftmost side of your first input row (to select the entire row) and CTRL+V all of your data at the same time.
Note there appears to be a limit to the number of entries you can make at the same time. It appears to sit at around 5,000 elements.
Adding on to #rmacd's answer, you can also get the GUID for a given MMS term by first manually entering the value(s) you need in a Quick Edit cell, then copy and paste the same value(s) from SharePoint to Excel. The pasted value will appear with the full term|guid that you need to complete the bulk copy/paste.