I am trying to get the import_asset_csv_to_matrix.php script to import about 1000 assets. I have a carefully created data-import.csv file, parent ID, Schema ID, metadata-associations.csv and asset-associations.csv files.
You didn’t use the Macintosh version of Microsoft Excel to create your CSV file by any chance, did you?
I remember we’ve had problems with that before, because for some reason Excel on MacOS X would save its CSV files using the old MacOS Classic linebreak (CR) instead of the MacOS X / UNIX linebreak (LF). So Matrix ends up seeing the file as one gigantic line of unparseable junk, with… sometimes interesting results.
You didn't use the Macintosh version of Microsoft Excel to create your CSV file by any chance, did you?
I actually did! Saved them as Windows CSV Files and it is working now. Thanks for pointing that out!
One other question. Can I use the script to set the created date? I was trying to map the created date attribute to created_date in Matrix, but that isn't working.
I think the problem you're having is that created_date corresponds to the "created" column in the sq_ast table itself, as opposed to being an attribute stored in the sq_ast_attr_values table. It looks to me like the created, published and updated dates are updated via the asset's setDate() function, not its setAttrValue() function, and I don't see any references to setDate() in import_asset_csv_to_matrix.php.
Unfortunately, the only places in the code I can see the "setDate" function being called are either as part of workflow processes, or from the asset's Settings screen. :(
You have Squizmap access, don't you, Nic? It might be worth logging an enhancement request...
Unfortunately, the only places in the code I can see the "setDate" function being called are either as part of workflow processes, or from the asset's Settings screen. :(
It does look like there is a Trigger action to set the date on an asset. So, when I import I could set the date as metadata, then use the After Asset Created action to set the Created Date from the metadata value.
Oh, I see now... the trigger action does set the date, but it does so via a direct DB update rather than via the setDate() function.
So that should work too. The only thing I'd be a bit cautious about is the potential performance penalty from doing a large import with triggers firing...
So that should work too. The only thing I'd be a bit cautious about is the potential performance penalty from doing a large import with triggers firing...
Good call. Would it be better to batch that trigger later? Any performance issues there?
I'm not sure, to be honest. I've never actually had to use batch triggers before, as most things can be handled more efficiently with the command-line scripts if you have access to them.