I am importing some nodes from csv file in drupal.
I am assigning row number to one of the field of that content type.
The first row in the csv is the header which contains the column names only. The data start from the second row.
I am using the "csvrownum" for the csv row number. But it starts from the first row. It should exclude the first row as the data starts from the second row. How will I do this?
Here is my code:
$this->source = new MigrateSourceCSV($path, $columns, array('header_rows' => 1));
//The destination CCK (boundle)
$node_options = MigrateDestinationNode::options("en", "full_html");
$this->destination = new MigrateDestinationNode('lot', $node_options);
$this->map = new MigrateSQLMap(
$this->machineName, array(
"csvrownum" => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'alias' => 'import'
)
), MigrateDestinationNode::getKeySchema()
);
//Field mapping
$this->addFieldMapping('title', 'Title');
$this->addFieldMapping('field_number', 'csvrownum');