XML Export
Sometimes there is a need to use Rukovoditel data outside the system - to work with other services or to transfer data.
Use the built-in export tool, and in a couple of clicks upload the data to an XML file of the desired format. Data can be exported in two ways: manually and automatically.
Where to start?
You can export data from any entity in the application. To do this, you need to create and configure a special template. Go to the "Extension-Templates-XML Export" menu.
On the General Info n tab, select the entity to export. You can create several different templates for a single entity. To manually export data, specify the "Button Position" option.
Access configuration
On the Access tab, configure access for users who can use manual export. Access can be configured for a group or for a specific user.
If you allow public access, the export will be available through a special link that appears in the list of templates. This way, a third-party app can automatically get data from a public link from your app.
Create template
On the Template tab, you create an XML template for exporting data. In the template body, you must prepare the XML code for a single entry. Use [field ID] to set the field value in the template.
Note: if the field value contains HTML tags or specials. characters, use the following format:
<![CDATA[ [ID поля] ]]>
Export images
To export images from attachments, use the following format:
{#157:<Image url="157_value" />}
157 - field id.
157_value - will be auto replaced by filename.
Note: on the attachment settings page, you must allow access for public attachments.
Example of an exported file:
Filters
By default, all records are exported. By clicking on the "Filters" link in the template list, you can configure which records you want to export.
PHP Code
If the template needs to display data in a certain format or by condition, you can insert your PHP code into the template.
To insert code, use next: <?php return YOUR_CODE; ?>
For example, to display the current date in ISO 8601 format, use: <?php return date('c'); ?>
In the body of the template, you can get the data of the current record using the $item
variable, for example, the date added $item['date_added']
Please note: for the Google Map type field, there are special functions for getting longitude/latitude, for example:
<location> <address>[215]</address> <latitude><?php return get_latitude($item['field_217']); ?></latitude> <longitude><?php return get_longitude($item['field_217']); ?></longitude> </location>
get latitude()
- latitude
get longitude()
- longitude
$item['field 217']
- the type of the Google Map field in which the coordinates are stored.
Related entities
On the Related Entities tab, you can include data from related entities. In the "Body" option, prepare xml for inserting a record from a related entity.
Insert the [entity_ID]
construct into the main body of the document.