Innovator.ReportEngine is a command-line application which extends Aras Innovator
to support using Razor templates
in addition to XSLT for reports.
It replaces the msxsl.exe
application used by Aras.
- Copy
Innovator.ReportEngine.exe
to your server (e.g.c:\Program Files (x86)\Aras\Innovator11sp12\Innovator\Server\bin
) - Modify your InnovatorServerConfig.xml
to use the application with the parameter
<operating_parameter key="xslt_processor" value="Innovator.ReportEngine.exe" />
(Alternatively, rename the application tomsxsl.exe
.) - Set the "XSLT" of your report to be a razor file wrapped in the
<razor>
element. For example:
<razor><![CDATA[
@using Innovator.Client;
@using System.Linq;
@{
var label = Model.Property("label").AsString(Model.Property("name").Value);
}
<!DOCTYPE html>
<html>
<head>
<title>ItemType</title>
</head>
<body>
<h1>@label</h1>
<p>Created: @Model.CreatedOn().AsDateTime().Value.ToString("MMM yyyy")</p>
<ul>
@foreach (var prop in @Model.Relationships("Property").OrderBy(p => p.Property("name").Value))
{
<li>@prop.Property("name").Value</li>
}
</ul>
</body>
</html>
]]></razor>
Innovator.ReportEngine mimics the command line usage of msxsl.exe
. In particular, the following
options are available:
Usage: Innovator.ReportEngine source stylesheet [options]
Options:
-? Show this message
-o filename Write output to named file
Remarks:
If `stylesheet` is a path ending in `.cshtml`, `.vbhtml` or has a root
element of `razor`, it is treated as a razor file. Otherwise, it is
treated as an XSLT stylesheet.
The stylesheet
parameter can be either an XSLT or Razor template. The application will decide
which one it is and how to process it.
- Language: The language (C# or VB) can be controlled with by setting the
lang
attribute tocs
orvb
(e.g.<razor lang="vb">...
). C# is the assumed default. - Model: Depending on your preferences, there are several APIs you can use to access the
incoming AML. To explcitly specify the one you want, add a line to your Razor template similar to
@model Namespace.Type
- By default, razor passes the view a model of the type
Innovator.Client.IReadOnlyItem
.
However, other Innovator.Client types can be used instead such asIItem
,IReadOnlyResult
,IResult
, and models likeInnovator.Client.Model.ItemType
- If you prefer an API that is more similar to the IOM provided by Aras, use the compatibility classes
from Innovator.Client such as
Innovator.Client.IOM.Item
. - If you want more control over how you process the AML, standard .Net classes are also available
including
XElement
,XmlElement
,string
,Stream
, etc.
- By default, razor passes the view a model of the type
To build the project, clone or fork the repository and run the build.ps1
file. Artifacts are
output to the artifacts
folder.