Export asset attributes to a table-based file. The attributes to be exported can be configured.


Introduction

A user wants to export Person assets as CSV in order to pass the data in a compatible spreadsheet format. With the default settings of the module "Asset Export/Import · Export Asset Attributes" the resulting file is a table consisting of only asset ID, and asset name. The attributes to be exported can be defined by mapping. The result of the mapping must match the export settings. So both XML files have to be adjusted in the Admin-Client.

Configuration

To fully conduct the desired export with all required data, you need to modify the module under "Special setup" with the missing table columns in the XML (Attribute mapping). This requires at least basic knowledge in XPath.

Open the XML for attribute mapping in the module's configuration dialog by clicking the button "Edit" after the name.

Add the missing mapping for the properties, "name", "first name" and "e-mail ". The common XPath single quotes must be entered XML-compliant (&apos). The returned value is the value string of the attribute.

<mapping default="=://asset_feature[@feature='censhare:address.first-name']/@value_string" dest="@first-name"/>     
<mapping default="=://asset_feature[@feature='censhare:address.last-name']/@value_string" dest="@last-name"/>     
<mapping default="=://asset_feature[@feature='censhare:address.uri-mailto']/@value_string" dest="@e-mail"/>
XML

The module expects similar information in the export file structure. Click the "Edit" button right behind the name and add the following lines to the XML. The default contains field keys only for "Asset ID" and "Asset Name". To complete the export, add the following three lines with the required attributes. The contents of the column name (column-name) can be set as well as the order of the columns. The exported attributes can now be assigned to the columns in the exported CSV table.

<field key="@first-name" column-name="First Name"/>   
<field key="@last-name" column-name="Last Name"/>   
<field key="@e-mail" column-name="E-Mail"/>
XML

With all this provided, the export can actually start. If you prefer to wrap the output fields in quotation marks, click the checkbox "Surround all fields with text delimiter".

To export the data with the "Export Asset Attributes" the user can select one or more Person assets in an asset query and then use the command from the context menu "Server actions" to start the export. After the command is launched you will see a dialogue showing the number and the name of the assets to be exported in a list. In addition, you can specify the name of the exported CSV file and enable the check-box to have the column names as headings in the table.

Note: The CSV file separates the fields using TABs by default, but not every spreadsheet application can handle this. Apple's Numbers actually expects a semicolon as a delimiter when opening CSV files. Therefore, in the case of Numbers, our CSV export is completely placed into column A of the worksheet and not divided into columns.

However, Numbers will handle comma-separated CSVs, if the file is not opened via "File · Open" or a double-clicked, but instead simply dragged and dropped into a blank worksheet on cell A1. If you use this spreadsheet app by default, "Field delimiter" has to be changed to ";" under "Special Setup" in the export module via the topmost pulldown menu. Then the CSV export opens correctly in numbers. Microsoft Excel, however, expects a comma as a field delimiter which is not offered as an option in the pulldown menu in the default of this module.

Do not forget to select the correct field delimiter.