2014년 12월 16일 화요일

Having problems importing CSV into fusion tables

Hi, I am importing a CSV file from excel into my fusion table. It all works apart from one column of text. The cells in this column contain a few paragraphs of text with line breaks and spaces etc. I have enclosed in double quotes e.g. "text". but it still does not work.

Can anyone help me out with this? I have tried a few things to no avail..



The way to get advice Johnny is to provide specific information.   In this case it means an example screen capture of your relevant blocks and an example of the cells in the column and a piece of your csv.

Why?  You provided a good verbal description possibly but what you think you did may not be what you actually coded and how you encode the text matters and we on the forum can not see how you did it.




CSV and other text delimited data files

Comma-separated value (.csv) files are a standard way to represent database values in text. Cell values with comma, newline or quotes must be quoted and quotes escaped by doubling. For example: "17"" LCD display". 
By convention, the first row acts as header and defines the names of the columns in the data. However, you can specify which row is the header during import.
Another character (for example, a tab, pipe or semicolon) can be used instead of a comma to separate data values in a text file. When importing a file like this, please specify the delimiter during import.




Hi Steve, I have attached a screen grab of the text in one of the boxes. Taifun, I had read the info on that page and on others. They recommend quoting "" which I have done but it still does not work....




actually that's not an App Inventor question...I would recommend you to ask in a Google fusiontable forum



ok, thanks. i will do. I didn't know there was one!



Just to add to this. I think the issue is to do with when the data goes into ai2 from my fusion table. I select all the data from  my fusion table and create a new list from the resultant CSV list. I manipulate this new table in app inventor2. The lists in Ai2 don't seem to like new lines, quotations etc...Is there any way round this? Or is there a list somewhere of what I can write and what Ican't?. 



this is the block once I have selected all the fusion table data...




I have no solution.  Do you notice you are doing a lot of things in the GotResult block. Generally, doing your processing within a block like this is not always a good idea.

You are possibly dealing with a timing issue ..not all blocks executing as rapidly as you hoped.    App Inventor is event driven, what this means is an action needs to complete before another takes place (actually it is a bit more complicated than that).  Restructuring your processing code to a Procedure or using a clock to stagger events might help.   Communication with a fusion table takes place over your Internet connection, it occurs sometimes rapidly, other times less rapidly.   Your app code may be trying to do things with a data set before the data set arrives?

You might read this exhaustive discussion:

execution order





 I think the issue is to do with when the data goes into ai2 from my fusion table. I select all the data from  my fusion table and create a new list from the resultant CSV list. 

ok, which means, you have been able to import your csv file successfully into a fusiontable
to find out what is going on, use Do it to debug your blocks, see also tip 4 here 

Top 5 Tips: How to learn  App Inventor

you also can deactivate some blocks during your tests
Taifun



Thanks both of you for your replies. It all works fine if I remove the quotes...but it falls down again if I enter a line return or other symbols. I would like to quote the paragraph so it accepts commas etc, but it just rejects the quotations....it's a mystery to me.



Hi Both, I hope you don't mind me reposting on this thread as I'm still stuck with this. After looking more closely my CSV table is sorted using a method that Taifun shared and then I set this as a CSV row. It turns out that the issue is with the amount of text. If I fill a few cells with paragraphs it can cope but if I do more then it falls over. So there must be a limit. I wandered if there was a way round this? I am considering having two fusion tables and then just looking the cells with paragraphs up at the end using job id but is there a way round this?




the sort function does the sort directly in the URI of the webviewer and there is a limit of around 2 MB (max. length of an URI).

you could adjust the sort example and pass the data in the WebViewString property to the webviewer, see also 


댓글 없음:

댓글 쓰기