Outputting Query Results to File

Outputting Query Results to File

One powerful tool for navigating your PLM data is Query Builder (QB). QB allows you to build custom queries to traverse connected data. Labs has multiple blogs going over how to use QB and how to utilize it with other technologies, like Tree Grid View and Dynamic Product Navigation. In 12SP8 however a new feature was added to output the results of a Query to an external file. This has many applications, and I’ll quickly run through a few of them in this post.

If you're new to Query Builder, you should take a look at the following Labs blogs, which cover a lot of topics. 

Intro to Query Definitions

Using Queries in your method code

Reverse Lookup Using Query Builder

Possible Applications

There are a few reasons why you’d want to export a query result to file. One of the most common reasons is the ability to work with the data outside of Aras Innovator. Within your query you can specify exactly what data is returned. This allows you to bring some of this data outside of innovator without worrying about sensitive data being viewed. The result is an XML structure which can be parsed by most common programming languages. This allows any developer to work with this data without intimate knowledge of the PLM system. 

Another use case for this could be for potential logging. You could schedule queries and save the results to a location for archival purposes, or create external scripts to generate reports from the result. The flexibility of Query Definitions allows you to pull any combination of data to create multiple different types of logs/reports. 

 

How to Enable

As of SP8 there is a new button which is enabled when attempting to run a Query Definition. Once you’ve checked that button and run your query, the result will be downloaded to the client system immediately.

The other options on this dialog allow you to limit the number of results, add parameters, and choose a flat result vs a structured result. Structured gives you more information about the relationships between results, while flat will give you a flat list of all items in the result.Here's an example of structured:

And here's an example of a flat output:

While this is a smaller change, knowing of it’s existence can save an administrator some time whenever they want to work with results of an executed query.

Conclusion

This is one of many feature improvements we’re making with recent service packs. Let us know which improvements you’ve enjoyed recently. I’d also love to hear how you’re utilizing query definitions within your operations.