fonction import

More
13 years 3 months ago #29805 by tonnick
fonction import was created by tonnick
hello !

juste une question sur la fonction import.

Si on ne met pas de delimitateur devant le premier item, cela ne fonctionne pas. ok.

Mais dans un fichier CSV, la premiere colonne est directement le premier groupe de mots. il n'y a pas de ~~

Il faut les ajouter à la main une fois terminé le csv avec notepad. et si par exemple, je m'aperçois que j'ai oublie qq chose, l'editeur (open office pour ne pas le citer) comprend qu'a cause de ces ~~ en debut, la premiere colonne est vide et me decale tous les contenus par rapport aux titres...

N'y a-t-il pas moyen de changer cela pour importer un csv "normal" ?

(FLEXIcontent version 2.0.0 RC8 (r1486))

merci de votre aide !

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #29808 by ggppdk
Replied by ggppdk on topic fonction import
You can configure, whatever format you have ...
just set the format that your CSV file has

everything is configurable, the suggested separator is to add more robustness to it


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #29812 by tonnick
Replied by tonnick on topic fonction import
yes you're right, it's better use separators.

but first of all, if I use ; instead of ~~, it does not work (of course remplacing ~~ by ; in Field Separator).

then, if I use as recommanded ~~, why do I have to put it before item column and not before field names column ?

this is not standard CSV format, I have to add it manually, and if I need modificate my file once ~~ added, it moves all columns itemns....

how can we avoid it ?

And one more thing, I have weblinks. But I cannot import them with title.

here is an exemple of my file :
"title"~~"text"~~"state"~~"type_of_product"~~"country"~~"world_regions"~~"legal_protection"~~"national_legislation"~~"external_link"
~~"Atest3"~~~~"3"~~"agricultural_product_and_foodstuff"~~"ES"~~"europe"~~"sui_generis"~~"[-addr-]=http://ec.europa.eu/agriculture/quality/door/registeredName.html?denominationId=1839!![-text-]=law"~~"[-

addr-]=http://ec.europa.eu/agriculture/quality/door/registeredName.html?denominationId=1839!![-text-]=link"

Could you detect where is the mistake ? thx for your help !

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #29813 by ggppdk
Replied by ggppdk on topic fonction import
since all separators are configurable i don't see what the problem is ??

first you need to clarify what you "standard" CSV file is using as field separators and as record (item) separators

e.g. for "standard" CSV use:
Field Separator: \t (this means description must not contain \t)
Field Encloser Character:
Item Separator: \n

also since you use enclosing character:
this
~~"Atest3"~~~~
should be:
~~"Atest3"~~""~~


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #29814 by tonnick
Replied by tonnick on topic fonction import
as said before, problem is not on separators, but on the way it is used.

1. if I use other field separators than the ones suggested (; instead of ~~), it does not work, so, all separators are not configurable. anyway doesn't really matter.

2. usual csv is :
title ~~ text ~~ textfield3 ~~ emailfield6 ~~ weblinkfld8 ~~ single_value_field22 ~~ multi_value_field24
title 1 ~~ description 1 ~~ textfield3 value ~~ [-email-]=usera@somedomain.com!![-text-]=usera ~~ www.somedomaina.com ~~ f22_valuea ~~ f24_value01%%f24_value02%%f24_value03

and not

title ~~ text ~~ textfield3 ~~ emailfield6 ~~ weblinkfld8 ~~ single_value_field22 ~~ multi_value_field24
~~ title 1 ~~ description 1 ~~ textfield3 value ~~ [-email-]=usera@somedomain.com!![-text-]=usera ~~ www.somedomaina.com ~~ f22_valuea ~~ f24_value01%%f24_value02%%f24_value03

Do you see the difference ?

in the import function we have to add on all item separators before the item itself.

this is a manual operation which :
- make lose time
- can be root cause of importations errors
- create issue when I need to modify the CSV with table programm as open office for exemple.

so, first question is, whatever the separator used, how can we avoid this phenomen and import usual csv ?

Then second question is for the weblinks, I cannot make it work. Can you see any error in the syntax ?


thx a lot for your dedicated time !

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #29819 by ggppdk
Replied by ggppdk on topic fonction import
inside
administrators/components/com_flexicontent/controllers/items.php

and inside function importcsv()

there is a line :
//echo "<pre>"; print_r($data); exit;

change it to :

echo "<pre>"; print_r($data); exit;

to see how you data of the FIRST item (first row) was parsed


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #29820 by tonnick
Replied by tonnick on topic fonction import
ok nice ! I'll try it ! thx

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #29821 by ggppdk
Replied by ggppdk on topic fonction import
The next thing to do for import is to add a debug step where the user will be presented with how his/her data will were parsed, and thus how they will be inserted into the Database this required just a little more time and was not done ... will be ...


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #29823 by tonnick
Replied by tonnick on topic fonction import
well, ok, using echo shows me how does it parse. great.

>> when I put something else than ~~ as separators (; in my case) it just confirm what I said, i does not work. but this is not my question. I do not have pb to use ~~.

But maybe I was not enough clear in english. question is, why, in field names rows, there is no need to begin with separators, while, for item, we need to begin rows with separators. once again, this is not the way to build a csv.

how can we change that ?

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #29825 by ggppdk
Replied by ggppdk on topic fonction import
You are importing articles which have a description field which can be 100 lines etc !!!

The description field (or other fields too)
-- may contain new lines
-- make contain quotes
-- may contain ~
etc !!!

the is why the initial suggestion of record separator is \n~~

ALL Separators are just SUGGESTIONS, and can be configured to use other characters, plus you have the flexibility of using multi-character separators

so, ANY setting will work you can use \n !!!
i have just test with record separator \n the ~~ in the begin of the line is not obligatory in any way !!!!!

But if you select a particular record (item) separator must not appear inside the record , e.g if you use \n as record separator then you cannot have \n inside the record

You can use any CSV file !!! just configure the separators.

And also remember you imported data must correspond to correct field names too


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save