stblink VIP
Total posts: 501
19 Dec 2012 13:28

Hi!

Is there any tutorial on how to import data into the constructor?

I will be using it for country-district-city

Having a csv or database of the data, whats the best way to import?

thanks

Last Modified: 02 Mar 2014


Guest
19 Dec 2012 14:51

hi

-currently you can not, you need to do that manualy

-i have a special database for that, tell me what countries do you want ?and after use sql queries


stblink VIP
Total posts: 501
19 Dec 2012 15:19

Brasil, Portugal and Angola


stblink VIP
Total posts: 501
21 Dec 2012 11:39

anyone? Is there any tutorial on how to correctly import data into the multi-level select field?


Sackgesicht VIP
Total posts: 1,636
21 Dec 2012 21:38

To understand the way data is stored there, this wikipedia article might help : Nested set model


stblink VIP
Total posts: 501
23 Dec 2012 08:12

Thanks Sack, but still having studied Pascal and C++ like 12 years ago i can look at that link and feel like i'm reading chinese language :O

When i'm starting to build up the form i guess i will insert some dummy data into the data field and then check the database to see how it looks. Perhaps i have a clearer view.


Sackgesicht VIP
Total posts: 1,636
23 Dec 2012 15:57

Actually the same applies to me. I can "only" understand the principle. :O

The "insert/performance problem" here is that every "insert" recalculates the whole node since it has to update the "right" value.

It might be a challenging task to create an import filter for the multilevelselect field. Maybe a skilled programmer or a community effort can help here.

Some more resources to it:

Nested sets

Good MySQL article plus resources

BAOBAB

Class for managing nested set data

Reordering nested sets


stblink VIP
Total posts: 501
23 Dec 2012 17:43

Kawasutra what kind of special database do you have ?

Asking this because perhaps it would be lot easier to copy the whole database field and after restore i delete the ones i dont want.


Guest
24 Dec 2012 10:21

zip and city database


Sergey
Total posts: 13,748
24 Dec 2012 12:13

How it should work? You select city and then get list of zips? Usually zips have to be entered manually.


Guest
25 Dec 2012 03:57

ok i thought we could with multilevel select


stblink VIP
Total posts: 501
25 Dec 2012 09:13

I found this post which suggests to convert the CSV file to JSON format.

CSV first line is the header columns and then comes the lines with the data. When converted it appears like each line has header and afterwards the data.

Now the difficult part (at least for me) is that same post they advice to, after converted to JSON, to use D3

Once you have the CSV loaded as JSON/javascript objects, you'll want to convert it from a flat list to a nested/hierarchical structure using d3.nest() as described here: https://github.com/mbostock/d3/wiki/Arrays#wiki-d3_nest.

As far as a simple way to get the results with a zoom function, you'll probably want to pick one of the example Tree Layouts from the wiki that you like ( https://github.com/mbostock/d3/wiki ) and take care to

get your data looking like the data in the example (via d3.nest()) and then switch the example to use your data instead of the example data.

Once again, this is chinese for me. I can see i will have lot's of work ahead :S


stblink VIP
Total posts: 501
25 Dec 2012 09:21

Sergey
Total posts: 13,748
25 Dec 2012 11:12

I have added load feature for latest field version. It is for Cobalt 8 but I believe you will be able install in on Cobalt 7. Al least install, load and then instal latest Cobalt 7 field back.


stblink VIP
Total posts: 501
25 Dec 2012 15:32

Wow great! Thanks Sergey.

I will be buying the subscription very shortly and when i download and test it i will get back to you.

Thank you once again!


stblink VIP
Total posts: 501
31 Dec 2012 05:56

I updated C7, Media Pack and Ip2country to latest release. Joomla 2.5.8

Installed Multilevel select V.8

1 - Uploading via Load Data accoding to the instructions (i used dummy data to test, just a txt created on notepad with 10 lines) resulted in many errors. File with errors in attachment

2 - Level Labels remained blank after load data

3 - On frontend, the field appears like this:

"You cannot select more then 3 options

Warning: Invalid argument supplied for foreach() in /public_html/w3/components/com_cobalt/fields/multilevelselect/multilevelselect.php on line 334

"

Although the first label appears, nothing works, neither edit, neither "your variant", neither the add button.

Also uploading the file i used to test.


Sergey
Total posts: 13,748
31 Dec 2012 06:20

I see. I have just discover that we had small speling mistake in table name of this field. So the table names are different in Cobalt 8 and 7. I afraid you will not be able to use Cobalt 8 MLS field in Cobalt 7.


stblink VIP
Total posts: 501
31 Dec 2012 06:44

That sucks..

The only thing that keeps me from using C8 is Emerald... I've heard that you plan releasing Emerald for J3.0 in about 3 month?


Sergey
Total posts: 13,748
31 Dec 2012 08:13

That sucks..

Tri this.

  1. Rename table _js_res_field_miltilevelselect to js_res_field_multilevelselect

  2. Try to import

  3. Rename it back.

That sucks..

The only thing that keeps me from using C8 is Emerald... I've heard that you plan releasing Emerald for J3.0 in about 3 month?

Correct.


stblink VIP
Total posts: 501
31 Dec 2012 09:29

Wow.. thanks! It worked. There was some labels repeated but i emptyed the "Level Labels" field and now everything works fine.

Actually on the backend, the version 8 of the field was everything fine... both the constructor and load data. Only the frontend showed the same error i posted before but showed the number in front of labels but the 2nd and 3rd level were not showing up.

After installing v.7 of the field and changing the table name now everything is fine.

just a small problem... it's not because of this that i won't use it:

On the txt i inserted the text with correct grammar and punctuation.

So... on the txt it was the city of "São Paulo"... when importing it cuts off after the punctuation.

So in the multilevel select it appears "S"

For the city of Portimão it only imported "Portim"

Thanks for the help!


Sergey
Total posts: 13,748
31 Dec 2012 23:27

Only the frontend showed the same error i posted before but showed the number in front of labels but the 2nd and 3rd level were not showing up.

Because it uses jQuery. And there is no jQuery in Joomla 2.5

Only the frontend showed the same error i posted before but showed the number in front of labels but the 2nd and 3rd level were not showing up.

On the txt i inserted the text with correct grammar and punctuation.

Fixed in upcoming release.

Powered by Cobalt