Ytria logo TUTORIALS

This website require JavaScript for full functionality. Please enable JavaScript in your Web browser.


 

Before you begin:

If you want to learn more about how Ytria's automation scripts function, see our automation basics help page.

For single databases:

Step 1 Copy/paste the script below into any text editor, change your values as needed, and save your file in XML format.
Step 2 Open scanEZ and select the 'Database > Load Automation File' option.
Step 3 Find and select the XML file you just saved, and then click 'Open.'

For multiple databases:

Step 1 Copy/paste the script below into any text editor, change your values as needed, and save your file in XML format.
Step 2 Open databaseEZ and load your server.
Step 3 Select the databases to add your new item to, right-click and select the option 'Execute Automation File on...' from the context menu, choose scanEZ from the list, select the servers you want to analyze, and then click 'OK'.
Step 4 Finally, find and select the XML file you just saved, and then click 'Open.'

Here is the script:

<?xml version="1.0" encoding="UTF-8"?>
<ytriaAutomation Application="scanEZ" ApplicationVersion="16.5">
<!--This will set the scripts behavior when encountering an error. In this case, it will continue.-->
<onerror continue="true" />
<!--Use the following variables to adapt the script to your own needs.-->
<!--TO SET :: this is THE FORMULA used. Currently, it is set to look for the string "PILOT" in the Subject field of the document.-->
<!--If you want to look for a different string in the same field, just replace PILOT with your string.-->
<!--Change the formula as desired. -->
<!--Note that the formula follows the general XML rules of "escaping".-->
<SetVar vSearchFormula="@Contains(@Uppercase(Subject);&quot;PILOT&quot;)" />
<!--TO SET :: This is the item to use as a main "key" for the report.-->
<SetVar vItemToUseAsKey="Subject" />
<!--This script block will perform the search for the documents-->
<!--and place those found in a new My Selection folder named "All Docs Found".-->
<!--The displayed document titles will be set to show the current database name,-->
<!--for reference in the resulting report.-->
<SearchBy Type="Formula">
<Setparam Field="SetFormula" Value="{%vSearchFormula%}" />
<Setparam Field="SearchDocuments" Value="true" />
<Setparam Field="SearchDesigns" Value="false" />
<Setparam Field="PutSearchInSelCreateName" Value="All Docs Found" />
<Setparam Field="TitleOptionType" Value="Formula" />
<Setparam Field="TitleOptionFormula" Value="@Implode(@DbName;&quot;!!&quot;)" />
</SearchBy>
<!--The following Focus line will place the focus on the newly-->
<!--created My Selection folder named "All Docs Found".-->
<Focus Target="Tree" Category="All Docs Found" />
<!--The following If condition declares that if the My Selection folder exists (i.e. documents have been found),-->
<!-- the nested child actions will be carried out.-->
<if Target="Tree" Test="FocusRoot" Mode="NotEquals" Value="True">
<!--This opens the Values grid. By default, the first column will be the value of the displayed selection tree title.-->
<Values>
<SetParam Field="AddItem" Value="{%vItemToUseAsKey%}" />
<!--This will remove the Type column.-->
<ShowTypeColumns value="false" />
<!--And this adds a custom column to display the UNID.-->
<AddCustomColumn name="UNID">
<SetParam field="TitleOptionType" Value="System" />
<SetParam field="TitleOptionSystem" Value="UNID" />
</AddCustomColumn>
<Evaluate />
<!--Finally, the results of the search will be exported into a report titled report_docs_found.xlsx.-->
<!--If this script is executed as part of a Loop/List, the newly found information-->
<!--will be exported and appended to the same file.-->
<Export>
<SetParam field="FilePath" value="{%CurFilePath%}report_docs_found.xlsx" />
<SetParam field="SelectedRowsOnly" value="false" />
<SetParam field="ExportType" value="Excel" />
<SetParam field="Mode" value="AppendRows" />
<SetParam field="ExcelSheetName" value="DOCS FOUND" />
<SetParam field="OpenFileOnceGenerated" value="False" />
</Export>
</Values>
</if>
</ytriaAutomation>