The Selection control supports five selection styles which determines their visual appearance and also determines whether a single item or multiple items can be selected.
To inspect a Selection control for yourself:
The Step Editor gives access to our Selection control as follows:
Inputs
Outputs
The Checkbox and MultiList styles are visually very similar and it is a matter of preference as to which should be used.
For these styles, the data editor Inputs and Outputs tabs will show an additional entry named SelectedItems.
Inputs
Outputs
From the agent's view, this works in the same way as the Selection control.
From a script writer and developer's perspective, it allows you to
The control is populated using XML in a fixed format, for both the Collection and Selection fields.
In the script, the following must be formatted on a single line.
For example:
<collection>
<entries>
<entry key="A1">Michigan</entry>
<entry key="B1">Vermont</entry>
<entry key="C1">Wisconsin</entry>
<entry key="C2">California</entry>
<entry key="D1">Alaska</entry>
</entries>
</collection>
In the script, the following must be formatted on a single line.
The Output always uses the key method to return the selected item(s):
<selection method="key">
<items>
<item>A1</item>
</items>
</selection>
The Input can use the key method (above) and also the value method (below):
<selection method="value">
<items>
<item>Michigan</item>
</items>
</selection>
The Data Query step can be used to take data from a database and return the data in an XML document. For usage details, see the Data Query control.
The database must be the same database as configured for the campaign's ODBC connection.
In order for a KeyedSelection control to make use of the returned result set, the shape of the data must be transformed, using the XSLT Transform step.
The Inputs and Outputs for the XSLT Transform step are:
Inputs
Outputs
Using the Mobiles database, we want to show some surnames and use the postcode as a key. Supposing the query is this:
SELECT postcode, surname FROM Mobiles WHERE Contact_ID >= 10 AND Contact_ID <= 15;
...then the output from the Data Query step looks like this:
<collection>
<entries>
<entry surname="Elmes" postcode="Y" />
<entry surname="Follett" postcode="Q" />
<entry surname="Reddel" postcode="QNUU" />
<entry surname="Challinor" postcode="AC" />
<entry surname="Little" postcode="MAQNI" />
</entries>
</collection>
... using this transform
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"></xsl:output>
<xsl:template match="/">
<collection>
<entries>
<xsl:for-each select="collection/entries/entry">
<entry>
<xsl:attribute name="key">
<xsl:value-of select="@postcode"></xsl:value-of>
</xsl:attribute>
<!-- append the attribute to element content-->
<xsl:value-of select="@surname"></xsl:value-of>
</entry>
</xsl:for-each>
</entries>
</collection>
</xsl:template>
</xsl:stylesheet>
... the transformed output is this:
<collection>
<entries>
<entry key="Y">Elmes</entry>
<entry key="Q">Follett</entry>
<entry key="QNUU">Reddel</entry>
<entry key="AC">Challinor</entry>
<entry key="MAQNI">Little</entry>
</entries>
</collection>
The same operation may be performed using the Execute SQL Select step instead of the Data Query step.
Using a different SELECT statement in this case, the output from the Execute SQL Select step would look like this:
<QueryResult>
<Row>
<Contact_ID>10</Contact_ID>
<Surname>Elmes</Surname>
</Row>
<Row>
<Contact_ID>11</Contact_ID>
<Surname>Follet</Surname>
</Row>
<Row>
<Contact_ID>12</Contact_ID>
<Surname>Reddel</Surname>
</Row>
<Row>
<Contact_ID>13</Contact_ID>
<Surname>Challinor</Surname>
</Row>
<Row>
<Contact_ID>14</Contact_ID>
<Surname>Little</Surname>
</Row>
</QueryResult>
... using this transform
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"></xsl:output>
<xsl:template match="/">
<collection>
<entries>
<xsl:for-each select="QueryResult/Row">
<entry>
<xsl:attribute name="key">
<xsl:value-of select="Contact_ID"></xsl:value-of>
</xsl:attribute>
<!-- append the attribute to element content-->
<xsl:value-of select="Surname"></xsl:value-of>
</entry>
</xsl:for-each>
</entries>
</collection>
</xsl:template>
</xsl:stylesheet>
... the transformed output is this:
<collection>
<entries>
<entry key="10">Elmes</entry>
<entry key="11">Follett</entry>
<entry key="12">Reddel</entry>
<entry key="13">Challinor</entry>
<entry key="14">Little</entry>
</entries>
</collection>