• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

List CSV list plugin

  • Views Views: 17,384
  • Last updated Last updated:

Navigation

  • This plug-in is run on each imported row when importing data from csv files.

    Since ?? it is also run on CSV export.

    It can be useful for massaging data into required formats or performing additional tasks. For example creating a Joomla user for each imported row.

    A useful thread if you are looking to import to import users by CSV: https://fabrikar.com/forums/index.php?threads/usertype-in-list-csv-list-plugin.39585/#post-199394

    Settings​

    upload_2021-5-20_11-42-22.png

    • Import Row PHP File- A file containing the PHP to run , located in
      • Fabrik 2.x: components/com_fabrik/plugins/tablecsv/scripts/
      • Fabrik 3.x plugins/fabrik_list/listcsv/scripts
    • Import Row PHP code - Code to run before each rows is imported. $formModel->updateFormData('yourtable___yourelement','new data') will modify the data (see example scripts for details). Returning false will skip the row. Will be run in addition to any selected file, so can call functions defined in the file(s)
    • (to do): for the additional import and export settings see the tooltips

    Example for Fabrik 4​

    Don't use $this in custom code. $listModel can be accessed directly.

    PHP:

    //ensure the file will only be called from within Joomla
    defined('_JEXEC') or die();

    // get a reference to the form model - as we are importing line by line, the form model contains the current
    // data that we are going to submit to the table.

    $formModel = $listModel->getFormModel();

    // the record's data is stored in the array 'formData' - to alter the element 'us_streets___street_desc' to the value 'testing' we use the following line:
    $formModel->formData['us_streets___street_desc'] = "testing";

    Example for Fabrik 3.1 or later​

    PHP:

    //ensure the file will only be called from within Joomla
    defined('_JEXEC') or die();

    // get a reference to the form model - as we are importing line by line, the form model contains the current
    // data that we are going to submit to the table.
    $listModel = $this->getModel();
    $formModel = $listModel->getFormModel();

    // the record's data is stored in the array 'formData' - to alter the element 'us_streets___street_desc' to the value 'testing' we use the following line:
    $formModel->formData['us_streets___street_desc'] = "testing";

    Example for older versions of Fabrik​

    PHP:

    //ensure the file will only be called from within Joomla
    defined('_JEXEC') or die();

    // get a reference to the form model - as we are importing line by line, the form model contains the current
    // data that we are going to submit to the table.
    $formModel = $tableModel->getForm();

    // the record's data is stored in the array 'formData' - to alter the element 'us_streets___street_desc' to the value 'testing' we use the following line:
    $formModel->formData['us_streets___street_desc'] = "testing";
Back
Top