board logo
WUICTeam
  • WUICTeam
  • 100% (Exalted)
  • Newbie Topic Starter
5 days ago
Question
I import an Excel file with a few hundred rows and one of them fails (a lookup description that does not exist, a value the database refuses). Are the other rows saved or not, and how do I try the file without writing anything?

Answer
It depends on commit_level, an option of md_props_bag.import that is also shown as a dropdown in the import dialog (unless skipsettings is true). The default is R. The whole file is always one transaction; the level only decides what happens at the first error.

  • R (rollback): the import stops at the first failing row and everything is rolled back. Nothing is saved.
  • I (stop): the import stops at the first failing row and the rows already processed are committed. Exception: when the error is a lookup that cannot be resolved (description not found, key and description that do not match), I behaves like R and saves nothing.
  • C (continue): the failing row is logged and skipped, the import goes on, and the good rows are committed at the end.
  • T (test): same as C, but at the end everything is rolled back. The log reports "Total records to be inserted / updated" and "Test completed successfully" or "with N errors".


How to use it
Run the file once with T, fix the rows listed in the log, then import with R. To make the dry run the preselected choice in the dialog:

{
  "import": {
    "enabled": true,
    "import_type": "I",
    "commit_level": "T",
    "skipsettings": false
  }
}

Mistake to avoid
With C the import ends with "Import completed with N errors" and the good rows are already committed: the file is partially imported. Do not simply re-run the same file: unless the file carries the primary key and import_type is "I" (insert-only, existing keys are skipped), the rows already saved are inserted again. Correct and import only the failed rows.

Documentation: Import