X4 Produktdokumentation

Random Number Generator

This adapter creates random numbers based on the specified configuration.

Properties

Operation

Defines the operation executed by the adapter

Possible values:

  • Generate: generates an XML document with one or more random numbers

  • SetRandomNumbers: generates random numbers into an existing XML document via XPath

Parameters

Adapter

Main adapter class (do not change!)

Possible values: de.softproject.integration.adapter.randomNumberGenerator.RandomNumberGenerator: Main class (default)

min

Minimum value from which a random number is to be generated

Possible values: any positive number, e.g. 1

(information) Mustn't be negative or 0.

max

Maximum value from which a random number is to be generated

Possible values: any positive number, e.g. 100

(information) Mustn't be negative or 0.

count

Number of random numbers to be generated

Possible values: any positive number, e.g. 4

(information) Mustn't be negative or 0.

XPath

XPath to the desired XML element

(information) Only important for the operation setRandomNumbers.

Possible values: any XPath expression, e.g. Data/Example

elementName

Name of the XML element in which the random number is to be generated.

(information) Only important for the operation setRandomNumbers.

Possible values: Any name for an XML element, e.g. Id.

Status values

1

The adapter operation was executed successfully and the output contains an XML document with the random number(s)

-1

An error occurred during execution

  • Operations Generate and setRandomNumbers: the parameter count is less than 1

  • Operation setRandomNumbers: the input is no XML document

Input

The adapter expects an XML document as input for the operation SetRandomNumbers.

Output

Depending on the operation, the adapter outputs the following results:

  • Operation Generate: XML document with the generated random number(s)

  • Operation SetRandomNumbers: XML document with added random number(s)

XML
<?xml version="1.0" encoding="UTF-8">
<Data>
  	<random>28</random>
  	<random>6</random>
	<random>10</random>
</Data>