Presets
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 version="1.0" encoding="utf-8" ?>
<PresetInfo>
<Code>ENTRIES</Code>
<SqlFile>file.sql</SqlFile>
<Format>Xlsx</Format>
<Action>Results</Action>
<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:
classDiagram
direction TB
class PresetInfo {
+string Code
+string SqlStatement
+string SqlFile
+SerializableParameters ParameterValues
+ExportFormatType Format
+PresetActionType Action
+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 parameterquery. - As an alternative you can provide a SQL statement in the preset, using
SqlStatement. Formathas the same meaning as the request parameterformat, chosen from list in Export Format Types.Actionhas the same meaning as the Endpoints.IncludeHeadersspecifies whether to add headers to the output where applicable. The associated request parameter isincludeheaders.HeaderFormatspecifies 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 isusetechnicalheaderswhich can be true or false.PrintParametersspecifies whether to print parameters in the output and can be true or false. The associated request parameter isprintparameters.ContentTypespecifies a deviating desired MIME Content-Type. The associated request parameter iscontenttype.DispositionTypespecifies a deviating desired disposition type. The associated request parameter isdispositiontype.ContentFileNamespecifies a deviating desired file name and download as attachment. The associated request parameter iscontentfilename.AccessControlfollows definition on all Invantive Web projects for access control, but specifically for the preset on which it is provided.LogRequestProgressis a boolean value whether for the specific preset request logging is required.- Connection name
ConnectionNamehas the same meaning as the request parameterconnection.
Many elements have a counterparty as shown in HTTP Request Parameters.
Preset Action Types
The following preset action type is available:
Results
The action Transform and the elements Xsl and XslOutputTranslate were removed in release 28.0. A preset with the action Transform is refused with itgendap235, one naming an XSL file with itgendap236 and one with XslOutputTranslate set to true with itgendap237; an empty Xsl element and XslOutputTranslate set to false are accepted and ignored.
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:
boolbyteByteArray: to process files presented as POST parameters.chardatetimedatetimeoffsetdecimaldoublefloatguidint16int32int64uint16uint32uint64objectsbytestring: text.timespannull
Examples
The preset for importing exchange rates in the Netherlands is:
<?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>