A preset is a file in the Templates folder that pre-defines a number of settings for an interaction. The format resembles the following XML structure:
```xml
<?xml version="1.0" encoding="utf-8" ?>
<PresetInfo>
<Code>ENTRIES</Code>
<SqlFile>file.sql</SqlFile>
<Format>Xml</Format>
<Action>Transform</Action>
<Xsl>ecotaksen-all.xsl</Xsl>
<XslOutputTranslate>true</XslOutputTranslate>
<LogRequestProgress>true</LogRequestProgress>
<ConnectionName>GROUP\MAIN</ConnectionName>
<ParameterValues>
<Parameter>
<Name>par</Name>
<DotnetDataType>int32</DotnetDataType>
<ForceValue>true</ForceValue>
<Value>25</Value>
</Parameter>
<Parameter>
<Name>upload_file</Name>
<DotnetDataType>ByteArray</DotnetDataType>
</Parameter>
</ParameterValues>
</PresetInfo>
```
## Diagram
All possible elements are depicted in the diagram:
```mermaid
classDiagram
direction TB
class PresetInfo {
+string Code
+string SqlStatement
+string SqlFile
+SerializableParameters ParameterValues
+ExportFormatType Format
+PresetActionType Action
+string Xsl
+boolean XslOutputTranslate
+boolean IncludeHeaders
+string HeaderFormat
+boolean PrintParameters
+string ConnectionName
+string ContentType
+string DispositionType
+string ContentFileName
+AccessControl AccessControl
+boolean LogRequestProgress
}
class SerializableParameters {
+SerializableParameter[*] Parameter
}
class SerializableParameter {
+string Name
+string DotnetDataType
+boolean ForceValue
+string Value
}
class AccessControl {
+boolean DefaultAllow
+AccessControlElement[*] AccessControlList
}
class AccessControlElement {
+string Description
+string Context
+string Url
+string ErrorCode
+string ErrorMessage
+boolean Allow
+dateTime ValidFromUtc
+dateTime ValidToUtc
+string LogOnCode
+string DataContainerId
+string IpAddressClientCidr
}
PresetInfo --> SerializableParameters : ParameterValues
SerializableParameters --> "0..*" SerializableParameter : Parameter
PresetInfo --> AccessControl : AccessControl
AccessControl --> "0..*" AccessControlElement : AccessControlList
```
## Preset Elements
The meaning of elements on `PresetInfo` is:
- The optional module code is registered as `Code`.
- SQL file (`SqlFile`) is preferably located also in the Templates and the contents of this file will be used as a pre-set for the request parameter `query`.
- As an alternative you can provide a SQL statement in the preset, using `SqlStatement`.
- `Format` has the same meaning as the request parameter `format`, chosen from list in [[Export Format Types]].
- `Action` has the same meaning as the [[Endpoints]].
- `Xsl` is the name of an XSL-file which is used in combination with the format `XML`. It defines the mapping through which the XML is processed. Many [[XSL Transformation Parameters]] are available.
- `XslOutputTranslate` specifies whether to apply XSL transformation.
- `IncludeHeaders` specifies whether to add headers to the output where applicable. The associated request parameter is `includeheaders`.
- `HeaderFormat` specifies what type of headers to include and can be `{name}` for a technical name and `{labelsingularcomposed}` for a user friendly name. The related request parameter is `usetechnicalheaders` which can be true or false.
- `PrintParameters` specifies whether to print parameters in the output and can be true or false. The associated request parameter is `printparameters`.
- `ContentType` specifies a deviating desired MIME Content-Type. The associated request parameter is `contenttype`.
- `DispositionType` specifies a deviating desired disposition type. The associated request parameter is `dispositiontype`.
- `ContentFileName` specifies a deviating desired file name and download as attachment. The associated request parameter is `contentfilename`.
- `AccessControl` follows definition on all Invantive Web projects for access control, but specifically for the preset on which it is provided.
- `LogRequestProgress` is a boolean value whether for the specific preset request logging is required.
- Connection name `ConnectionName` has the same meaning as the request parameter `connection`.
Many elements have a counterparty as shown in [[HTTP Request Parameters]].
## Preset Action Types
The following preset action types are available:
- `Results`
- `Transform`
## Parameter Values
Values to bind to SQL parameters can be specified using `ParameterValues`. Parameter values specified in a preset overrule identically named request parameters. Parameter values consist of a list of parameters and their values, where each parameter has three elements:
- Name (`Name`) of the parameter.
- Data type (`DotnetDataType`) of the parameter.
- String representation (`Value`) of the parameter value.
- Whether for force the use of the parameter value specified or only use it as a default (`ForceValue`).
## Parameter Data Types
The following parameter data types are available:
- `bool`
- `byte`
- `ByteArray`: to process files presented as POST parameters.
- `char`
- `datetime`
- `datetimeoffset`
- `decimal`
- `double`
- `float`
- `guid`
- `int16`
- `int32`
- `int64`
- `uint16`
- `uint32`
- `uint64`
- `object`
- `sbyte`
- `string`: text.
- `timespan`
- `null`
## Examples
The preset for importing exchange rates in the Netherlands is:
```xml
<?xml version="1.0" encoding="utf-8" ?>
<PresetInfo>
<SqlFile>any-currency-import-query.sql</SqlFile>
<Format>json</Format>
<Action>Results</Action>
<ConnectionName>DEFAULT\ecbeolnl</ConnectionName>
<LogRequestProgress>true</LogRequestProgress>
<ParameterValues>
<Parameter>
<Name>country</Name>
<DotnetDataType>string</DotnetDataType>
</Parameter>
<Parameter>
<Name>divisions</Name>
<DotnetDataType>string</DotnetDataType>
</Parameter>
<Parameter>
<Name>number_of_days</Name>
<DotnetDataType>string</DotnetDataType>
</Parameter>
<Parameter>
<Name>currencies</Name>
<DotnetDataType>string</DotnetDataType>
</Parameter>
<Parameter>
<Name>testrun</Name>
<DotnetDataType>string</DotnetDataType>
</Parameter>
<Parameter>
<Name>reference_date</Name>
<DotnetDataType>string</DotnetDataType>
</Parameter>
</ParameterValues>
</PresetInfo>
```