By default, when importing a csv file which has the names of the database columns as its header, similar_text is used to compare the header with the column names, and maps them together if they have over 80% similarity.
In this question, @AbuGhufran explains that this default can be changed so that they are only mapped if they are exactly equal. However, this can only be done by changing part of the core grid code.
There are two issues with this:
- Making this change may only be possible for server admins. Any regular developer will need to ask the admins to change this code for them.
- This change is a global setting – it makes it impossible to use the similar_text method on one page, and the “exactly equal” method on another page.
It would be much more convenient to have a grid option, like below, which would select the method to use for the mapping. Would it be possible to add this option?
$opt[“import”][“columnmapping”] = “exact”; // the other option could be “similar”
Hello,
Thanks for the suggestion.
This feature was previously requested via email by a customer and added in latest build.
If you want to adjust CSV headers and database fields mapping accuracy, default: 80:
$opt[“import”][“match”] = 95;
$g->set_options($opt);
So for exact match, you can set it to 100.
Online documentation will be updated soon as well.
PS: Check your email for latest build.