Template for .csv file?

Started by dski, 19 November 2013, 09:09:33

Previous topic - Next topic
A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

dski

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

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

federica

Hi Dimitris,
thanks for your compliments.
Which abook version are you installed?
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]

dski

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!

federica

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.
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

dski

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

federica

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.
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]

dski

#6
  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