How do the 'to' and 'from' filters work in a custom document template?

Charlie O'Neil
Charlie O'Neil
  • Updated

The 'to' and 'from' tags are powerful filters that allow you to look into a related items field values when looping through configuration items. Use these filters when defining the type of configuration item you will be looping through in the initial KQL tag. Additionally, you will be able to use the 'to' and 'from' tag as a filter when searching for items on the 'All Items' screen in Ketryx.

 

As an example, we can use the 'to' filter when looping though test executions to pull only the test executions that execute a validation test case shown in this example: {$KQL validationTE's = type:TE and to:("Test type":"Validation")}. Since the relation between a test execution and a test case lives on the test execution (a TE 'executes' a TC), we will be using the 'to' tag when we are looping through TE's to see data from a TC. Additionally, if you were searching on the 'All Items' page in Ketryx, you can input TE and to:("Test type":"Validation") into the search bar to see test executions that only execute a validation test. This filter allows us to see into a relating items field values at the start of the loop even when the relation would result in an itemRecordCore.

 

The 'from' filter works in the same way as the 'to' filter, but is used when the relation does not live on the items that you are looping through. For instance, if we were to take the example above but flip it so that we want to loop through test cases that are executed by test executions with a passing result, we would use the 'from' filter since the relation does not live on the items we are looping through. The KQL templating tag for this example would look like this: {$KQL passingTC's = type:TC and from:("Test result":"Pass")}. Additionally, searching on the 'All Items' page would look like this: TC and from:("Test result":"Pass").

 

These two filters are very useful by refining a search based off of a relating items field values and when pulling specific configuration items into a document template. 

Related to

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.