Invalid SQL: INSERT INTO `swsessions` (`sessionid`, `ipaddress`, `lastactivity`, `useragent`, `isloggedin`, `sessiontype`, `typeid`, `dateline`, `status`) VALUES('65d25aaabfd3dc6c74f534aed5917ecc', '54.81.157.56', '1503094608', 'CCBot/2.0 (http://commoncrawl.org/faq/)', '0', '40', '0', '1503094608', '0'); (The table 'swsessions' is full)
Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\support.inm.com\includes\functions.php:410) in C:\Inetpub\support.inm.com\includes\functions.php on line 1612
How to return the unique values of a field - Support Center
inm logo
Corporate Website | Contact | Store | Support | Login  
     


Knowledgebase
View categorized listing of all common frequently asked questions.
Downloads
View our categorized library of downloads for all necessary manuals, software, etc.
 Article Options
Support Center » Knowledgebase » INM V12 Database for Director » How to return the unique values of a field
Support Page Banner
 How to return the unique values of a field
Product:Platform:Area:Version:
INM V12 Database for DirectorWindows, MacintoshSearching and sorting3.x Regular & Light

Summary

It is sometimes useful to retrieve each value only once in a database. This is possible to achieve in INM V12 Database by using the mGetUnique method. This method returns unique values of the Master Field in a string or a Lingo list.

Example

mGetUnique is very convenient to populate a user interface element (such as scrolling list or pull-down menu) with search values that are relevant only for a specific database and context. For instance, clicking on a menu would develop all possible values for a given field. Then, by choosing one, the field that contains the records is updated, showing only the values that matches the selection, and each of the other menus are updated to show the new valid choices!

Example: In a clothing catalogue, you want to display only the available colors for a specific category and size of product (e.g., T-shirt and XXL). You run the following script:

mSetCriteria(gTable, "category", "=", "T-shirt") mSetCriteria(gTable, "and", "size", "=", "XXL") mOrderBy(gTable, "color") mSelect(gTable) put mGetUnique(gTable, "literal") into field "ScrollList"

This script retrieves unique values of the "color" field (which is the Master Field) to the field "ScrollList". Assuming that your selection contains 30 records (10 with Color = "Red", 10 with Color = "Green" and 10 with Color = "Blue"), the above script puts the string...
Blue
Green
Red
... in field "ScrollList".

Note


This example can be easily understood with a complete code sample. We suggest you download the sample available here. It demonstrates a user-interface where searches in a V12 Database file are performed through dynamic pop-up menus. The contents of the menus are constantly updated to reflect the actual values available in the V12 Database selection.

In this sample, at start-up, each menu is built by retrieving the selection (mGetSelection) for a specific field, sorting it, removing duplicates and finally placing the result in the pop-up menu.

When the user selects an item in a pop-up menu, a search is performed in the V12 Database file with the appropriate keyword and all menus are updated again, as described above.

Sample


This sample is supported on Director 6.5 and later. zip   sit



Article Details
Article ID: 105
Created On: 26 Sep 2006 02:27 PM

 This answer was helpful  This answer was not helpful

inm general footer
Services Xtras Go Products Support Gallery Store Download About Us Contact Newsroom