This topic is locked

Names of imported columns

7/1/2016 6:28:15 PM
PHPRunner Tips and Tricks
F
FunkDaddy author

I needed a way to find out the names of the columns a user selected to import in case they didn't select all importable columns (those available during import).
Ex Scenario: I have a list page with 100 columns which can all be imported. Say a user imports, but only maps 10 fields and ignores the other 90 or intentionally chooses not to map them. How can you know which columns to focus on in case you need to run additional post import processing? See my answer below.
In the "After Import Finished" event you can



//convert class object to array to find out which columns were mapped

$mapped_columns = (array) $pageObject;
$columns = $mapped_columns['importData']['importFieldsData'];

$console = '';
foreach($columns as $value){

console .= $value['fName'] . ', ';//pass this to a $_SESSION var or something else that you can use for post processing :-)

}
$console = rtrim($console, ', ');//remove last comma
//Now you can see the column names in your console

echo "<script>

console.log('" . $console . "');

</script>";