# Mergado 2: Element-Path

**URL:** <https://forum.mergado.com/t/mergado-2-element-path/540>\
**Category:** Help Center\
**Tags:** mergado-2\
**Created:** [July 22, 2022, 11:55am UTC](https://forum.mergado.com/t/mergado-2-element-path/540 "2022-07-22T11:55:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lukashorak](https://forum.mergado.com/user_avatar/forum.mergado.com/lukashorak/32/154_2.png) [@lukashorak](https://forum.mergado.com/u/lukashorak)\
**Post date:** [July 22, 2022, 11:55am UTC](https://forum.mergado.com/t/mergado-2-element-path/540/1 "2022-07-22T11:55:42Z")

</div>

# _Mergado 2: Element-Path_

We are introducing _Element-Path_, **a language completely created by Mergado**. It is designed for users to take full advantage of all the new features of Mergado 2 in the rules and queries. Read how this innovation works

## 👩‍🏫 What is Element-Path

- a language for **specifying values ​​of product elements** in Mergado - path to an element or an attribute
- it is used in **rules and product queries**
- **path to an element** or **element path** ( **element-path** ) with lowercases denotes an expression written using the Element-Path language
- the result of one path to an element **can be multiple values** , ​​and we can use it in rules for simple modification of multiple elements

## ❓ Differences between Mergado and Mergado 2

_ **How the current version of Mergado works:** _

- the products are listed in a table
- one line = one product
- one column = one element
- path to an element (element name) = query of one column in the table
- MQL is then the query of specific rows in the table

_ **How the new Mergado 2 works:** _

- products are lists of trees
- one product = one tree from the list
- one element value = one node in the tree
- one element = set of nodes in the tree with the same element name
- path to an element = a query of any number of nodes with the same element name
- MQL = a query of specific trees from the list

 ![Mer_vs_Mer_2_EN_bile_pozadi](https://forum.mergado.com/uploads/default/original/1X/d6e3e5f38b1a73ce3fb214736b7f1a1adc0856b6.png)

_Preview of differences between Mergado vs. Mergado 2._

### 👉 Example of using Element-Path on a sample product::

**Product:**

```auto
1. <ITEM id="1">
2. <NAME>Sample product</NAME>
3. <IMAGE>https://www.imgurl.cz/1/</IMAGE>
4. <IMAGE>https://www.imgurl.cz/2/</IMAGE>
5. <IMAGE>https://www.imgurl.cz/3/</IMAGE>
6. <PRICE>30 EUROS</PRICE>
7. <DESCRIPTION lang="en">
8. Suitable for demonstrating the correct use of Element-Path
9. </DESCRIPTION>
10. <DESCRIPTION lang="de">
11. Sample german language value.
12. </DESCRIPTION>
13. <PARAM>
14. <NAME>Color</NAME>
15. <VAL>black</VAL>
16. </PARAM>
17. <PARAM>
18. <NAME>Material</NAME>
19. <VAL>100% cotton</VAL>
20. </PARAM>
21 </ITEM>

```

### 👩‍💻 Different paths to values of elements:

- **NAME** : returns the value from line `2.`
- **ID** : returns the value from line `1.`
- **IMAGE** : returns values from lines `3.`, `4.`, `5.`
- **IMAGE { @@POSITION = 2 }** : returns the value from line `4.`
- **IMAGE { @@POSITION = 4 }** : returns nothing
- **DESCRIPTION { @lang = “en” }** : returns the value from line `8.`
- **DESCRIPTION | @lang** : returns values from lines `7.`, `10.`
- **PARAM { NAME = “Color” } | VAL** : returns value from line `15.`
- **PARAM { @@POSITION = 2 or NAME = “Color” } | VAL** : returns values from lines `15.`, `19.`
- **PARAM { VAL = “100% cotton” } | VAL** : returns the value from line `19.`
- **PARAM | NAME** : returns values from lines `14.`, `18.`
- **PARAM | NAME { @@POSITION = 1 }** : returns values from lines `14.`, `18.`
- **PARAM | NAME { @@POSITION = 2 }** : returns nothing

## 📋 Element-Path specifics

- you must wrap multi-word element names in square brackets:

> [Engine capacity] = “2 l”→ ! wrap only one element name at a time

- a large number of elements in the query is undesirable

> ID = 1 or ID = 2 or ID = 3 → ID ~ “^(1|2|3)$”

- numerical constants are converted to a number → problem with 0 at the beginning

> ID = “0021”

- the non-existence of an element is tested using equality to an empty string
- for multiple elements, it is sufficient that a single value satisfies the condition

Do you have any questions regarding Element-Path or Mergado 2? Contact our [support](https://www.mergado.com/contact) and follow this [forum thread](https://forum.mergado.com/t/introducing-mergado-2/538) for the latest information.
