1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

import existing mysql table

Discussion in 'Community' started by MeAppBuilder, Jan 8, 2020.

  1. MeAppBuilder

    MeAppBuilder Member

    Level: Community
    Hello Fabrik Team,

    I have a table with >100 columns. I know I have asked this before, but please allow me to ask again.

    Is it possible to import a table by now or do we have to create each field?

    In my case, I have > 100 fields that are just text.

    Or is my best bet: create a table, check the database how fields are saved and bulk INSERT from Excel?

    Also. It would be great, if we could edit the table name once created.
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    What do you mean with "existing mysql table"?

    If it's already existing in your database you can just create a new list and select the "Database table" in the list's "Data" tab.
    In Fabrik Options you can set how elements labels should be created from columns names automatically (you can edit the labels afterwards if you like/need to).
    Table names (i.e. the name in the database) can't be edited but you could rename your database table before creating the list.

    If you want to import a CSV file (should be UTF8) you can use the "Import" in list listing. Here you can chose the table name, which columns to import, which element types to create etc.
     
    MeAppBuilder likes this.
  3. MeAppBuilder

    MeAppBuilder Member

    Level: Community
    thank you. i will try.
     
  4. MeAppBuilder

    MeAppBuilder Member

    Level: Community
    Ok, I am at the same point as before.
    Fabrik isn't really user friendly, when it comes to renaming tables.

    //////////

    Sorry for asking again.

    //////////

    I have created a list/form with table name "LABEL_FABRIK_USER".
    The table name in MySQL is "LABEL_FABRIK_USER" as well.
    This table name is a mistake!
    Now I need to change the table name to "fabrik_user".
    I will use the form as a register form with JUSER Plugin.

    How can I change the table name and keep all elements that I have already created?

    I have tried to create a new form/list and tried to copy all elements, but there is always a problem with already existing "ID" element or "date and time" element.
    Also, a copy will establish a connection between the original field and the new field, rather then actually copying the element.
    I am really confused on this. I don't want to break my form.

    //////////

    My initial question:

    I have an already existing MySQL table.

    Do I have to create a form and each element by hand or can I "import" an existing table with all elements???

    As I said, I have a table with > 100 columns and I don't want to create each element by hand.
     
  5. troester

    troester Well-Known Member Staff Member

    Level: Community
    You'll mess up your application if renaming database stuff which may be used at different places.

    Why do you need to rename the database table name at all? Fabrik users will see only the list label and form label which you can change at any time.
    So copy all but id and date_time element (which are created at list creation automatically).
    Afterwards you can trash the original elements and then empty trash without dropping the columns.

    If your original elements are used somewhere (prefilter, ordering, CCD element, placeholders, plugins ...) you have to adapt these places

    Other possibility:
    In form listing use "Content type"/Export
    Then create a new list with the table name you want and select the new content type when you are asked to do so.
     
    MeAppBuilder likes this.
  6. MeAppBuilder

    MeAppBuilder Member

    Level: Community
    thank you so much. Content Type Export did the trick.
     

Share This Page