Page 1 of 1

Failed to Import

Posted: Sun Sep 25, 2022 7:09 am
by juniorpinto

v2023, when trying to load data through the import function from an excel sheet, nothing is loaded despite advancing the primary key value. It is as if the data has been loaded and then deleted.


Re: Import function

Posted: Sun Sep 25, 2022 10:05 am
by arbei

You need to press the "Save" button (see the Improved Data Import) to save, alse see the advanced setting Import records with transaction.


Re: Import function

Posted: Mon Sep 26, 2022 8:14 pm
by juniorpinto

In my case... not show the buton save and dont load all.


Re: Import function

Posted: Mon Sep 26, 2022 11:47 pm
by arbei

Then you should enable Debug to check server side errors in the log file on your server, and also check HTTP response in your browser.


Re: Import function

Posted: Thu Sep 29, 2022 9:46 am
by SRanade

Import will fail if you have fields that are empty and the table requires non-NULL values. In such case you can manually assign values when the fields are blank. Then import works.

Similarly import will fail if data length in imported field is longer than the field size in database.

You have to ensure data integrity on your own to ensure that rows are accepted.

Try to enable Import records with transaction (in advanced settings) to see the list of data rows with indication of failed rows.

I think internally PHPMaker tries to save the row to database, and if it gets an error message of any kind, it considers the import as failed without giving you the reason.

Once I set all null or blank or extra-long values manually in Row_Import, everything works beautifully.

For example:

function Row_Import(&$row, $cnt)
{
    Log($cnt); // Import record count
    Log(print_r($row, true)); //raw row data. Won't reveal NULL values

    //ensure non-NULL values
    if (strlen(trim($row["first_name"])) < 1) $row["first_name"] = "";
    if (strlen(trim($row["last_name"])) < 1) $row["last_name"] = "";
    if (strlen(trim($row["email"])) < 1) $row["email"] = "";
    $row["password"] = ""; //password is null as there is no data on this in import file, so set it to non-NULL
    return true;
}

Re: Import function

Posted: Thu Sep 29, 2022 10:04 am
by arbei

Note that you may check HTTP response to see the result of each record with success or error message. The results are under the Network -> EventStream panel.


Re: Import function

Posted: Fri Sep 30, 2022 2:39 am
by juniorpinto

The problem was my Xampp server. To solve I needed to configure:
zlib.output_compression=off


Re: Import function

Posted: Thu Apr 06, 2023 1:03 pm
by bui

My table engine is InnoDB
Import is inserting the data correctly but I did not get the option/button to SAVE .
Only CLOSE button is showing.

How can I bring the SAVE button.


Re: Failed to Import

Posted: Thu Apr 06, 2023 3:33 pm
by mobhar

You might need this: Advanced Settings for Import.