Declare a field for XML datasource

When the fields come from an XML datasource, then the fields need to have, apart from the name and type, the "Description" property. The description property is based on the attribute of a node or the value of the child node.

Defining fields is perfom in the report query window. It's done in 2 steps:

  • Write the xpath/xpath2 query.
  • Find available nodes in the right panel. Drag and drop the nodes you need from the panel to the bottom panel to register them as fields.
    Note: The description of each field is the relative path to the node based on the Query you wrote. So if the query is //food and the description of the field is "name" then, the field will be using //food/name values.

How to write the xpath/xpath2 query?

The query will look like /xpath/query/to/my/nodes.
If you are interested to the node 'nodes' and that it can be found at 
/xpath/query/to/my/nodes or /other/path/to/nodes, then you may use the double slash '//' which means any path. So your query will look like that //nodes.

Last you may be interested to access a property value of a node instead of the node value.

Similar to my previous example if you have the following XML segment:

<name>Jack</name>

to declare the field on "name", the "Description" should be also specified as "name".

On the other hand, consider this:

<name value="Jack"></name>

The query will be //name and then the "Description" should be specified as "@value".

 

Feedback
randomness