Vox Populi(x) forum

Alexandria Book Library => Supporto (Support) => Topic started by: dski on 19 November 2013, 09:09:33

Title: Template for .csv file?
Post by: dski on 19 November 2013, 09:09:33
Hello,

Thnx for the very nice component! We plan to use it for our school library. Since we already have some information for our books in text format it would be nice to insert all this in the library using a .csv file. However I was unable to find a template for the .csv file (I tried to export a book in .csv format but it didn't work, there is probably a problem with the access permissions in our sql database). It would be nice if you could provide a sample .csv

All the best!

Dimitris
Title: Re: Template for .csv file?
Post by: federica on 10 December 2013, 10:47:47
Hi Dimitris,
thanks for your compliments.
Which abook version are you installed?
Title: Re: Template for .csv file?
Post by: dski on 03 January 2014, 10:13:02
Hello Federica!

Happy new year! Thank you for your reply. Please excuse me for my delayed response. We are using Alexandria Book Library 2.0.4. under Joomla 2.5.14.

All the best!
Title: Re: Template for .csv file?
Post by: federica on 20 January 2014, 20:09:16
Hi dski,
fields list: title, subtitle, alias, id editor, price, pag, user id,  user alias, description, image name, file name, year, id location, id library, vote, numvote, hits, published, qty, isbn, approved, userid, url, url label, date insert, catalog, checked_out, checked_out_time, access, metakey, metadesc, note, editedby, catid, authors.
The authors field is an item list separated by semicolon.

Tip: insert some test data (books, categories, authors, editors, locations and library) then export them in a csv file. Open the csv file e and add the new data. Now delete the test data and import the csv file.
Title: Re: Template for .csv file?
Post by: dski on 17 February 2014, 14:04:03
Hi again Federica!

Thank for your help with the .csv file.

It seems that there is a problem with exporting books to .csv file since although a .csv file is generated it contains no data and a vast number of error messages (maybe I should post a part of the file here in a new thread to let you check it. Maybe it is a problem with our database)

So, I tried to create a .csv file on my own using the format you gave me and after several tries I managed to insert some books in the library. However there are a couple of things that I would like to ask you:

1.What is the value for the field "access" so that a book is available to all (Public)?

2.How do I define an item list for authors? Can you give me an example? However, even with a single author, although the book is inserted, the author does not appear (even if I have already added his name to the authors' list)

Thank you in advance!

Dimitris
Title: Re: Template for .csv file?
Post by: federica on 21 February 2014, 15:59:43
Dear Dimitris,
perhaps the errors appears because the database contains Greek characters. Thank you for this notice, I will try to fix it as soon as possible.

The field "access" is the access id, you can reach it in users->access level at the ID column

The author list is a author ID list separated by semicolon, you can reach they in components->alexandria library->authors at the ID column.

I hope that I explained well.
Title: Re: Template for .csv file?
Post by: dski on 21 February 2014, 16:54:28
  Hello Federica,

  Thanks for your help and clarifications. I think I got it now! :-)

  As for the error with the export of .csv file, maybe it is due to the use of greek characters. In order to give you an idea I copy-paste the error message I get:

============================================================
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /unitswww1/unitswww17/att-g/gym-peir-ag-anarg/gaganpeira/public_html/new/administrator/components/com_abook/models/importexport.php on line 108

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /unitswww1/unitswww17/att-g/gym-peir-ag-anarg/gaganpeira/public_html/new/administrator/components/com_abook/models/importexport.php on line 108
============================================================

This same error appears a few hundred times in the exported .csv file (it seems that the number of appearances is somehow connected to the number of books in a category. In two cases I tried, in a category with 13 books the message appeared 468 times (that is 13x36) and in a category with 22 books it appeared 792 times (that is 22x36). If I counted correctly, 36 is the number of fields for each book in the .csv file. If this is correct, it means an error message for each field).

At the end of the file I get lines like this:

"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""

that is "empty" .csv lines. The number of lines matches the number of books in the category I attempt to export.

  I hope that you'll be able to resolve this. If you find out something please let me know :-)

  All the best!

  Dimitris
Title: Re: Template for .csv file?
Post by: federica on 17 March 2014, 09:30:46
Hi dski,
at line 108 there is this PHP function mysql_real_escape_string(). Check if the server has some restrictions.
Title: Re: Template for .csv file?
Post by: dski on 16 July 2014, 12:34:26
  Hi Federica,

  One more question about the format of the .csv file. I managed to insert book using a .csv file however although at the column authors (the last one) I put the ID (as a plain number) of an author already inserted int the database, although the book is inserted the author field data appear empty. What I do wrong? In a previous message in this topic you wrote that the author field is in fact a list of authors IDs separated by semicolon. I want to put just a single author in a book. If his ID in the database is eg 123 how should it be written in the .csv file; 123, "123", [123],"[123]"?

  Thanks for all your help!
Title: Re: Template for .csv file?
Post by: federica on 25 August 2014, 11:12:29
Hi dski,
you have to write .....;"123";.......