The mgiDynamicList Tag

Tag Behavior

Use the mgiDynamicList tag to dynamically build a delimited list of unique values. Multiple sources of values can be used to build one list.


Tag Syntax

The mgiDynamicList tag has five sources. Each source has different required and optional parameters. The sources of mgiDynamicList are:

  • postArguments - Dynamically creates a delimited list of unique values from post arguments.
  • pathArguments - Dynamically creates a delimited list of unique values from path arguments.
  • pageVariables - Dynamically creates a delimited list of unique values from page variables.
  • databaseField - Dynamically creates a delimited list of unique values from a database field.
  • string - Dynamically creates a list of delimited unique values from a delimited string of values.

PostArguments, PathArgument and PageVariable Sources

The postArguments, pathArgument and pageVariable sources of mgiDynamicList tag have one required parameters and two optional parameters. The tag form is:

<mgiDynamicList source="Source" order="Order" 
listDelimiter="Character">

Required Parameters:

  • source - The source is the location of the list values. The "postArguments" source creates list values from all post arguments. The "pathArguments" source creates list values from all path arguments. The "pageVariables" source creates list values from all page variables. Multiple source parameters may be included in one mgiDynamicList tag.

Optional Parameters:

  • order - The order determines the ordering of the list values. If the order parameter value is "alphabetical", then list values are alphabetized from A to Z. If the order parameter value is "numerical", then the list values are listed in ascending order from smallest to largest. When using the "numerical" order, all list values must be numbers. If the order parameter value is "none", then the list values are left in their original order. The default value is "None".
  • listDelimiter - The listDelimiter is the character that separates each value in the list. To use escape characters such as carriage returns, line feeds, and tabs as delimiters use the appropriate Escaped String format. The default list delimiter is a comma.

DatabaseField Source

The databaseField source of mgiDynamicList tag has three required parameters and five optional parameters. The tag form is:

<mgiDynamicList source="databaseField"  
databaseName="Database" fieldName="Field" order="Order" 
listDelimiter="Character" odbcDatasource="Source Name" 
odbcUsername="Name" odbcPassword="Password">

Required Parameters:

  • source - The source is the location of the list values. The "databaseField" source creates list values from all values in a specified database. Multiple source parameters may be included in one mgiDynamicList tag.
  • databaseName - The databaseName is the name of the database that contains the field values to be included in the list.
  • fieldName - The fieldName is the name of the database field that contains the values to be included in the list. The database field must be a "text" type field.

Optional Parameters:

  • order - The order determines the ordering of the list values. If the order parameter value is "alphabetical", then list values are alphabetized from A to Z. If the order parameter value is "numerical", then the list values are listed in ascending order from smallest to largest. When using the "numerical" order, all list values must be numbers. If the order parameter value is "none", then the list values are left in their original order. The default value is "None".
  • listDelimiter - The listDelimiter is the character that separates each value in the list. To use escape characters such as carriage returns, line feeds, and tabs as delimiters use the appropriate Escaped String format. The default list delimiter is a comma.
  • odbcDatasource (NT only) - The odbcDatasource is the name of datasource on the server that provides access information for an external ODBC database. If the odbcDatasource parameter is included, database information will be retrieved from the specified ODBC database rather than the internal MGI database. Inquire with the server administrator for additional information about the use of ODBC databases. If you include the odbcDatasource parameter, the odbcUsername and odbcPassword parameters are required.
  • odbcUsername (NT only) - The odbcUsername is the username required to access the ODBC datasource. The odbcUsername parameter is required if you include the odbcDatasource parameter.
  • odbcPassword (NT only) - The odbcPassword is the code required to access the ODBC datasource. The odbcPassword parameter is required if you include the odbcDatasource parameter.

String Source

The string source of mgiDynamicList tag has three required parameters and two optional parameters. The tag form is:

<mgiDynamicList source="String" name="Name" string="Text" 
stringDelimiter="Character" order="Order" 
listDelimiter="Character">

Required Parameters:

  • source - The source is the location of the list values. The "string" source creates list values from all values in a specified string of characters. Multiple source parameters may be included in one mgiDynamicList tag.
  • string - The string is the delimited text to use as the list values.
  • stringDelimiter - The stringDelimiter is the character that separates each value in the string. To use escape characters such as carriage returns, line feeds, and tabs, use the appropriate Escaped String format.

Optional Parameters:

  • order - The order determines the ordering of the list values. If the order parameter value is "alphabetical", then list values are alphabetized from A to Z. If the order parameter value is "numerical", then the list values are listed in ascending order from smallest to largest. When using the "numerical" order, all list values must be numbers. If the order parameter value is "none", then the list values are left in their original order. The default value is "None".
  • listDelimiter - The listDelimiter is the character that separates each value in the list. To use escape characters such as carriage returns, line feeds, and tabs as delimiters use the appropriate Escaped String format. The default list delimiter is a comma.


Example Usage and Output

PostArguments Source

<mgiDynamicList source="postArguments" order="Alphabetical">

In this example, categories from a form submission are ordered alphabetically and displayed in a delimited list list.

Architecture,Baby Care,Fashion,Health and Beauty,Science and Technology

PathArguments Source

<mgiDynamicList source="pathArguments" 
order="Numerical" listDelimiter="-">

In this example, available quantities are passed via path arguments and are used to create a list with values in numerical order separated by dashes.

1-10-100-200

PageVariables Source

<mgiDynamicList source="pageVariables" listDelimiter="\r">

In this example, available product sizes from page variables are used to create a list delimited with carriage returns. The list values are not re-ordered.

XL
S
M
L
2X

DatabaseField Source

<mgiDynamicList source="databaseField" fieldName="Jobs"
databaseName="JobDatabase" order="Alphabetical">

In this example, a list of jobs in a database are used to create a list.

C++ Programmer,Database Programmer,LAN Specialist,System Administrator

String Source

<mgiDynamicList source="string" stringDelimiter=","
string={mgiPostArgument name="Names"} listDelimiter="/">

In this example, a string of names delimited by commas from a form submission is embedded in the string parameter of mgiDynamicList to create a list of names delimited by a slash.

Beth Johnson/Anita Brown/Bradley West/Cole Sanders

Multiple Sources

<mgiDynamicList source="postArguments" source="pathArguments" 
order="Alphabetical">

In this example, values from post arguments and path arguments are used to create a list.

A23345,A26789,BC2234,D99382,LM2345,P92345,X23459


Suggested Usage

  • Searchable Databases
  • Form Processing


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]