# Filing definition by longest match
Assume you want to file delivery notes from your suppliers with a specific metadata form in alphabetical order. In addition, you want to distinguish between S, Sm, and St. This allows you to file suppliers such as Smith, and Stiller separately.
# Prepare folders
Create a Purchasing folder with a Suppliers child folder.
In the Suppliers folder, create a child folder for each letter of the alphabet. Also create folders named Sm and St.
The metadata form in this example uses the field Suppliers (L1).
Enter the following path in the Filing path field:
[¶Purchasing¶Suppliers¶]+L1(1,1)+[%]+L1(2,2)
The contents of the Filing path field are automatically applied to the Filing definition field when you exit the field.
Information
[¶Purchasing¶Suppliers¶]: ELO searches for the Purchasing folder and the Suppliers child folder.
+L1(1,1): ELO starts by checking the first character of the first field.
+[%]: The percent sign instructs ELO to file by the longest match. If it finds a match for the first character, ELO carries on checking.
\L1(2,2): ELO checks two characters from the second character in the first field.
With this filing definition, ELO checks whether a folder exists under the specified path (Purchasing//Suppliers) that matches the first three characters of the contents of the first field.
ELO uses the longest match for filing.
Click Save to save the changes to the metadata form.
Now, if a document is filed with this metadata form using the Automatic filing function, the filing definition applies.
A document for the supplier Sanborn can only be filed to the S folder. A document for the supplier Smith also has an S at the beginning. However, the match for the Sm folder is longer, so ELO files the document there.