You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php
require 'vendor/autoload.php';
use DivineOmega\uxdm\Objects\Migrator;
use DivineOmega\uxdm\Objects\Sources\XMLSource;
use DivineOmega\uxdm\Objects\DataItem;
use DivineOmega\uxdm\Objects\DataRow;
use DivineOmega\uxdm\Objects\Destinations\CSVDestination;
$xmlFile = __DIR__.'/play.xml';
$xPathQuery = '/ACES/App';
$xmlSource = new XMLSource($xmlFile, $xPathQuery);
$csvFile = __DIR__.'/output.csv';
$csvDestination = new csvDestination($csvFile,['Part','BaseVehicle','DriveType']);
$migrator = new Migrator;
$migrator->setSource($xmlSource)
->setDestination($csvDestination)
->setFieldsToMigrate(['BaseVehicle','DriveType','Part'])
->setKeyFields(['Part'])
->withProgressBar()
->migrate();
If the XML doesn't have DriveType defined for some of the "rows", the CSV file should still have the same number of columns with one blank. Instead, it's just missing the column.
Thanks - unfortunately I have no control over the source file. It is sent to me from a manufacturer, and "DriveType" is just one of several tags that may or may not be blank unfortunately.
I might be doing something completely wrong...
If the XML doesn't have DriveType defined for some of the "rows", the CSV file should still have the same number of columns with one blank. Instead, it's just missing the column.
For example, input:
You'll notice the first item has a DriveType but the second one doesn't. Here's the resulting CSV:
The second line should actually be:
The text was updated successfully, but these errors were encountered: