MashZone NextGen 10.2 | Appendix | Legacy Presto components | Mashables and Mashups | Mashups in MashZone NextGen Wires | Customizing Wires | Limit Custom Block User Entries to a List of Values | Literal List Values
 
Literal List Values
To provide a list of literal valid values, you add the macro metadata element <type> to the corresponding <parameter> and set the datatype to enum. Add <list> as a child of <type>:
<macros xmlns="http://www.open-mashup.org/schemas/v1.0/EMML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openmashup.org/schemas/v1.0/EMML/..
/schemas/EMMLPrestoSpec.xsd"
domain="myBlocks">

<macro name="helloWorld"
xmlns:presto="http://www.jackbe.com/v1.0/EMMLPrestoExtensions"
xmlns:macro="http://www.openmashup.org/schemas/v1.0/EMMLMacro">
<presto:macro-meta>
<block usage="Wires">
...
</block>
<parameters>
...
<parameter name="aList">
<label>Choose a customer category</label>
<required>true</required>
<type datatype="enum">
<list></list>
</type>
</parameter>
</parameters>
</presto:macro-meta>
....
</macro>
...
</macros>
You then define the valid values as a simple string with values separated by commas using the <values> element inside <list>. With this configuration, the values you supply are also the labels that users see in the list:
<macros xmlns="http://www.open-mashup.org/schemas/v1.0/EMML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openmashup.org/schemas/v1.0/EMML/..
/schemas/EMMLPrestoSpec.xsd"
domain="myBlocks">

<macro name="helloWorld"
xmlns:presto="http://www.jackbe.com/v1.0/EMMLPrestoExtensions"
xmlns:macro="http://www.openmashup.org/schemas/v1.0/EMMLMacro">
<presto:macro-meta>
<block usage="Wires">
...
</block>
<parameters>
...
<parameter name="aList">
<label>Choose a customer category</label>
<required>true</required>
<type datatype="enum">
<list>
<values>platinum,gold,silver</values>
</list>
</type>
</parameter>
</parameters>
</presto:macro-meta>
....
</macro>
...
</macros>
If the values are not self-explanatory or you simply want to provide alternate labels, use a set of <option> elements rather than <values>.
Define the label to show in the label attribute and the value to send to the macro as the value of <option>:
<macros xmlns="http://www.open-mashup.org/schemas/v1.0/EMML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openmashup.org/schemas/v1.0/EMML/..
/schemas/EMMLPrestoSpec.xsd"
domain="myBlocks">

<macro name="helloWorld"
xmlns:presto="http://www.jackbe.com/v1.0/EMMLPrestoExtensions"
xmlns:macro="http://www.openmashup.org/schemas/v1.0/EMMLMacro">
<presto:macro-meta>
<block usage="Wires">
...
</block>
<parameters>
...
<parameter name="aList">
<label>Choose a customer category</label>
<required>true</required>
<type datatype="enum">
<list>
<option label="Platinum">1</option>
<option label="Gold">2</option>
<option label="Silver">3</option>
</list>
</type>
</parameter>
</parameters>
</presto:macro-meta>
....
</macro>
...
</macros>

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release