# IInputParameters

Description:

`IInputParameters` is a collection for creating and managing the `InputParameter` of a `Job`.
```cpp
import "OxSvrSpt.idl"
```
Public Methods:
```cpp
HRESULT AddNewStringParameter ([in] BSTR Name, [in] BSTR Value, [out, retval] IParameter ** ppVal)
HRESULT AddNewIntegerParameter ([in] BSTR Name, [in] long Value, [out, retval] IParameter ** ppVal)
HRESULT AddNewBooleanParameter ([in] BSTR Name, [in] VARIANT_BOOL Value, [out, retval] IParameter ** ppVal)
HRESULT AddNewDoubleParameter ([in] BSTR Name, [in] double Value, [out, retval] IParameter ** ppVal)
```
```cpp
HRESULT AddNewDatetimeParameter ([in] BSTR Name, [in] DATE Value, [out, retval] IParameter ** ppVal)
HRESULT AddNewXMLParameter ([in] BSTR Name, [in, defaultvalue("")] BSTR XML, [out, retval] IParameter ** ppVal)
HRESULT AddNewByteParameter ([in] BSTR Name, [in, optional] VARIANT Value, [out, retval] IParameter ** ppVal)
HRESULT AddParameter ([in] IParameter * Parameter)
HRESULT Remove ([in] VARIANT Index, [out, retval] IParameter ** ppVal)
HRESULT Clear ()
```
Properties:
```cpp
long Count [get]
IParameter Item([in] VARIANT Index) [get]
```
Documentation of Element Functions:

* `HRESULT AddNewBooleanParameter ([in] BSTR Name, [in] VARIANT_BOOL Value, [out, retval] IParameter ** ppVal)`

`AddNewBooleanParameter` creates a new Boolean parameter, adds it to the collection and returns it. The parameter name must not be an empty string, otherwise an error is returned. If you try to add a parameter with a name that already exists, an error is thrown.

Parameters:

: `Name` name of the parameter.

: `Value` initialization value of the parameter.

: `ppVal` (VB return parameter) created and initialized parameter object.

Exception handling:

`errInputParametersCantCreate` (1101) The parameter could not be created. No further information is available in this case.

`errParameterNameEmpty` (1201) No name was specified for the parameter.

`errParameterDoubleName` (1202) A parameter with the specified name already exists.

* `HRESULT AddNewByteParameter ([in] BSTR Name, [in, optional] VARIANT Value, [out, retval] IParameter ** ppVal)`

`AddNewByteParameter` creates a new byte parameter, adds it to the collection and returns it. The parameter name must not be an empty string, otherwise an error is returned. If you try to add a parameter with a name that already exists, an error is thrown.

The value can be passed as a string during initialization or added later via the `AppendChunk` or `Stream` functions. If the value for `Value` is to be initialized later, a Variant of type `VT_NULL` or `VT_ERROR` must be passed.

Under VB and VB-Script, the `Value` parameter of the method does not need to be specified if the binary data are to be added to the parameter object at a later time.

Parameters:

: `Name` name of the parameter.

: `Value` initialization value of the parameter.

: `ppVal` (VB return parameter) created and initialized parameter object.

Exception handling:

`errInputParametersCantCreate` (1101) The parameter could not be created. No further information is available in this case.

`errParameterNameEmpty` (1201) No name was specified for the parameter.

`errParameterDoubleName` (1202) A parameter with the specified name already exists.

Example:
```vb
Dim oParameter As OxSvrSpt.Parameter
Set oParameter = m_oInputParameters.AddNewByteParameter(strName)
```
* `HRESULT AddNewDatetimeParameter ([in] BSTR Name, [in] DATE Value, [out, retval] IParameter ** ppVal)`

`AddNewDatetimeParameter` creates a new Double parameter, adds it to the collection and returns it. The parameter name must not be an empty string, otherwise an error is returned. If you try to add a parameter with a name that already exists, an error is thrown. VT_8

Parameters:

: `Name` name of the parameter.

: `Value` initialization value of the parameter.

: `ppVal` (VB return parameter) created and initialized parameter object.

Exception handling:

`errInputParametersCantCreate` (1101) The parameter could not be created. No further information is available in this case.

`errParameterNameEmpty` (1201) No name was specified for the parameter.

`errParameterDoubleName` (1202) A parameter with the specified name already exists.

* `HRESULT AddNewDoubleParameter ([in] BSTR Name, [in] double Value, [out, retval] IParameter ** ppVal)`

`AddNewDoubleParameter` creates a new Double parameter, adds it to the collection and returns it. The parameter name must not be an empty string, otherwise an error is returned. If you try to add a parameter with a name that already exists, an error is thrown. VT_8

Parameters:

: `Name` name of the parameter.

: `Value` initialization value of the parameter.

: `ppVal` (VB return parameter) created and initialized parameter object.

Exception handling:

`errInputParametersCantCreate` (1101) The parameter could not be created. No further information is available in this case.

`errParameterNameEmpty` (1201) No name was specified for the parameter.

`errParameterDoubleName` (1202) A parameter with the specified name already exists.

* `HRESULT AddNewIntegerParameter ([in] BSTR Name, [in] long Value, [out, retval] IParameter ** ppVal)`

`AddNewIntegerParameter` creates a new Integer parameter, adds it to the collection and returns it.

The parameter name must not be an empty string, otherwise an error is returned. If you try to add a parameter with a name that already exists, an error is thrown. VT_I4

Parameters:

: `Name` name of the parameter.

: `Value` initialization value of the parameter.

: `ppVal` (VB return parameter) created and initialized parameter object.

Exception handling:

`errInputParametersCantCreate` (1101) The parameter could not be created. No further information is available in this case.

`errParameterNameEmpty` (1201) No name was specified for the parameter.

`errParameterDoubleName` (1202) A parameter with the specified name already exists.

* `HRESULT AddNewStringParameter ([in] BSTR Name, [in] BSTR Value, [out, retval] IParameter ** ppVal)`

`AddNewStringParameter` creates a new String parameter, adds it to the collection and returns it.

The parameter name must not be an empty string, otherwise an error is returned. If you try to add a parameter with a name that already exists, an error is thrown.

Parameters:

: `Name` name of the parameter.

: `Value` initialization value of the parameter.

: `ppVal` (VB return parameter) created and initialized parameter object.

Exception handling:

`errInputParametersCantCreate` (1101) The parameter could not be created. No further information is available in this case.

`errParameterNameEmpty` (1201) No name was specified for the parameter.

`errParameterDoubleName` (1202) A parameter with the specified name already exists.

Example:

C++
```cpp
try
{
    IInputParametersPtr spParameters( spJob->InputParameters );
    _bstr_t bstrParameterName( L"Name" );
    _bstr_t bstrParameterValue( L"Wert" );
    spParameters->AddNewStringParameter( bstrParameterName, bstrParameterValue );
}
catch( _com_error& e )
{
    // Get error description
    _bstr_t bstrError = e.Description( );
    // If no error description was provided by the COM error object...
    if( bstrError.length() == 0 )
    {
        // ... get the system error message
        bstrError = e.ErrorMessage();
    }
    // TODO: bstrError contains the error description for further processing.
}
```
* `HRESULT AddNewXMLParameter ([in] BSTR Name, [in, defaultvalue("")] BSTR XML, [out, retval] IParameter ** ppVal)`

`AddNewXMLParameter` creates a new XML parameter, adds it to the collection and returns it. The parameter name must not be an empty string, otherwise an error is returned. If you try to add a parameter with a name that already exists, an error is thrown.

The value can be passed as a string during initialization or added later via the `AppendChunk` or `Stream` functions.

Under VB and VB-Script, the XML parameter of the method does not need to be specified if the XML data are to be added to the parameter object at a later time.

Parameters:

: `Name` name of the parameter.

: `XML` initialization value of the parameter.

: `ppVal` (VB return parameter) created and initialized parameter object.

Exception handling:

`errInputParametersCantCreate` (1101) The parameter could not be created. No further information is available in this case.

`errParameterNameEmpty` (1201) No name was specified for the parameter.

`errParameterDoubleName` (1202) A parameter with the specified name already exists.

Example:

```vb
Dim oParameter As OxSvrSpt.Parameter
Set oParameter = m_oInputParameters.AddNewXMLParameter(strName)
```
* `HRESULT AddParameter ([in] IParameter * Parameter)`

`AddParameter` adds the passed parameter to the collection.

This method makes it possible to pass parameters from other calls without copying.

Parameters:

: `Parameter` parameter to be added.

Exception handling:

`errInputParametersCantCreate` (1101) The parameter could not be created. No further information is available in this case.

`errParameterNameEmpty` (1201) No name was specified for the parameter.

`errParameterDoubleName` (1202) A parameter with the specified name already exists.

Example:
```vb
Dim oParameter As OxSvrSpt.Parameter
...
' Fill parameter in another job call
...
m_oInputParameters.AddParameter(oParameter)
```
* `HRESULT Clear ()`

`Clear` removes all elements from the collection.

* `HRESULT Remove ([in] VARIANT Index, [out, retval] IParameter ** ppVal)`

[abn.Remove](../abn.md#abn.Remove) removes the entry with the passed identifier from the parameter list and returns it.

If the specified entry is not found, an error is returned.

Parameters:

: `Index` name or position of the entry to be removed from the parameter collection. If the `Index` parameter is passed as `Integer` or `Long`, the item at the corresponding position is searched. In C++, a Variant of type VT_12 or VT_14 must be passed in this case. If the `Index` parameter is passed as a string (VT_BSTR), the item name is searched.

: `ppVal` (VB return parameter) returns the removed parameter object.

Exception handling:

`errCollectionItemNotFound` (1304) The requested entry was not found.

`errCollectionIndexOutOfRange` (1303) The requested index is outside the range.

Documentation of Properties:

* `long Count [get]`

`Count` returns the number of elements in the collection.

Parameters:

: `plNumber` (VB return value) number of elements in the collection

* `IParameter Item([in] VARIANT Index) [get]`

`Item` returns the specified element of the collection based on position or key.

If a position outside the valid index is specified, an error with the error value `errCollectionIndexOutOfRange` is returned. If the item cannot be found, an error with the value `errCollectionItemNotFound` is returned.

Parameters:

: `Index` position or name of the requested element

: `ppItem` corresponding parameter object
