When the user clicks the Values button for a field, Stonefield Query displays a list of unique values for that field. This is done using a SELECT DISTINCT query on that field. However, there may be occasions when, due to the way the data is stored, you need a different mechanism for gathering the values to display to the user, such as calling a stored procedure. In that case, create a values method plugin for the field.

For example, suppose the Customers table has 100,000 records but the CustomerType field only contains one of ten different values. Performing a SELECT DISTINCT query on this field might be slow, depending on the database engine you're using. Instead, you could create a plugin that returns the ten different values.

A values plugin implements the IStonefieldQueryValuesMethodPlugin interface in Interfaces.dll and uses the StonefieldQueryValuesMethodPlugin attribute. Your plugin needs references to the Collections, Enums, Interfaces, PluginManager, and System.ComponentModel.Composition assemblies (the first four are Stonefield Query assemblies and the latter is a .NET assembly). It may also need references to other Stonefield Query assemblies, depending on what the plugin does; these can be found in the SQWeb\bin folder.

Studio can generate the source code for a plugin for you; see the Generating Plugin Source Code topic for details.


Here's the definition of IStonefieldQueryValuesMethodPlugin:

using System;
using System.Collections;

namespace Stonefield.Query.Plugins
    /// <summary>
    /// The interface that ValuesMethod plugins must implement.
    /// </summary>
    /// <remarks>
    /// Plugin classes implementing this interface must have an
    /// attribute that implements
    /// IStonefieldQueryValuesMethodPluginMetaData.
    /// </remarks>
    public interface IStonefieldQueryValuesMethodPlugin :
        /// <summary>
        /// Returns the list of values for the field.
        /// </summary>
        /// <returns>
        /// The list of values for the field.
        /// </returns>
        IList GetValues();

(As with all plugins that derive from IStonefieldQueryBasePlugin, it also has an Application member; see the Plugins topic for information about Application.)


The StonefieldQueryValuesMethodPlugin attribute on the plugin class has the following parameters (see the Plugins topic for details):

  • The ID for the plugin.

  • The name of the plugin.

  • The type of plugin.

  • The ID (as a string) of the field associated with the plugin.

Here's an example:

    Version = "",
    ExecutionPriority = 5)]
public class SampleValuesMethodPlugin :

Plugin methods

Values method plugins have a single method: GetValues.

See Also