Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Issue with ComboBoxItem text match style and AdvancedCriteria

    Hello,

    I am using a ComboBoxItem with an AdvancedCriteria specified as option criteria and have set the matching behavior to TextMatchStyle.STARTS_WITH. However, it looks like TextMatchStyle.SUBSTRING is used instead, so that the pick list contains more values than it should.

    Here is a basic example that illustrates the problem. It is based on a DataSource using an Oracle system table. I have tested it with Smart GWT power edition 2.5 (latest nightly build) and Firefox 3.6.

    ComboBox definition:
    Code:
    ComboBoxItem comboBox = new ComboBoxItem();
    comboBox.setOptionDataSource(DataSource.get("test"));
    AdvancedCriteria criteria = new AdvancedCriteria("tname", OperatorId.NOT_IN_SET, new String[] {"test1", "test2", "test3"});
    comboBox.setOptionCriteria(criteria);
    comboBox.setValueField("tname");
    comboBox.setDisplayField("tname");
    comboBox.setRequired(true);
    comboBox.setTextMatchStyle(TextMatchStyle.STARTS_WITH);
    Data Source:
    Code:
    <DataSource ID="test" serverType="sql" tableName="sys.tab">
    	<fields>
    		<field name="tabtype" type="text" />
    		<field name="tname" type="text" />
    	</fields>
    </DataSource>
    Server logs (please note the first '%' character in 'LIKE LOWER('%system%')':
    Code:
    === 2011-10-19 13:32:28,924 [l0-0] INFO  SQLDataSource - [builtinApplication.test_fetch] Performing fetch operation with
    	criteria: {operator:"and",_constructor:"AdvancedCriteria",criteria:[{fieldName:"tname",operator:"notInSet",value:["test1","test2","test3"],_constructor:"AdvancedCriteria"},{_constructor:"AdvancedCriteria",operator:"and",criteria:[{fieldName:"tname",operator:"iContains",value:"system"}]}]}	values: {operator:"and",_constructor:"AdvancedCriteria",criteria:[{fieldName:"tname",operator:"notInSet",value:["test1","test2","test3"],_constructor:"AdvancedCriteria"},{_constructor:"AdvancedCriteria",operator:"and",criteria:[{fieldName:"tname",operator:"iContains",value:"system"}]}]}
    === 2011-10-19 13:32:28,924 [l0-0] INFO  SQLDataSource - [builtinApplication.test_fetch] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
    === 2011-10-19 13:32:28,925 [l0-0] DEBUG SQLDataSource - [builtinApplication.test_fetch] Executing row count query: SELECT COUNT(*) FROM $defaultTableClause WHERE $defaultWhereClause
    === 2011-10-19 13:32:28,925 [l0-0] DEBUG SQLDataSource - [builtinApplication.test_fetch] Eval'd row count query: SELECT COUNT(*) FROM sys.tab WHERE (NOT((sys.tab.tname IN ('test1', 'test2', 'test3')) AND sys.tab.tname IS NOT NULL) AND ((LOWER(sys.tab.tname) LIKE LOWER('%system%') {ESCAPE '\'} AND sys.tab.tname IS NOT NULL)))
    === 2011-10-19 13:32:28,967 [l0-0] INFO  SQLDriver - [builtinApplication.test_fetch] Executing SQL query on 'oracle': SELECT COUNT(*) FROM sys.tab WHERE (NOT((sys.tab.tname IN ('test1', 'test2', 'test3')) AND sys.tab.tname IS NOT NULL) AND ((LOWER(sys.tab.tname) LIKE LOWER('%system%') {ESCAPE '\'} AND sys.tab.tname IS NOT NULL)))
    === 2011-10-19 13:32:28,982 [l0-0] WARN  SQLDataSource - [builtinApplication.test_fetch] DataSource 'test': sqlPaging was explicitly specified as 'sqlLimit', but the underlying database (oracle) does not support SQL limit queries.  Falling back to 'jdbcScroll'
    === 2011-10-19 13:32:28,983 [l0-0] DEBUG SQLDataSource - [builtinApplication.test_fetch] JDBC driver windowed select rows 0->75, result size 75. Query: SELECT sys.tab.tname, sys.tab.tabtype FROM sys.tab WHERE (NOT((sys.tab.tname IN ('test1', 'test2', 'test3')) AND sys.tab.tname IS NOT NULL) AND ((LOWER(sys.tab.tname) LIKE LOWER('%system%') {ESCAPE '\'} AND sys.tab.tname IS NOT NULL)))
    === 2011-10-19 13:32:28,994 [l0-0] INFO  DSResponse - [builtinApplication.test_fetch] DSResponse: List with 17 items
    DSRequest from Developer Console (please note that the textMatchStyle attribute is set to "startsWith" but the criteria operator is "iContains"):
    Code:
    {
        "dataSource":"test", 
        "operationType":"fetch", 
        "componentId":"isc_PickListMenu_0", 
        "data":{
            "operator":"and", 
            "criteria":[
                {
                    "fieldName":"tname", 
                    "operator":"notInSet", 
                    "value":[
                        "test1", 
                        "test2", 
                        "test3"
                    ]
                }, 
                {
                    "operator":"and", 
                    "criteria":[
                        {
                            "fieldName":"tname", 
                            "operator":"iContains", 
                            "value":"system"
                        }
                    ]
                }
            ]
        }, 
        "startRow":0, 
        "endRow":75, 
        "textMatchStyle":"startsWith", 
        "resultSet":[ResultSet ID:isc_ResultSet_2 (created by: isc_PickListMenu_0)], 
        "callback":{
            "caller":[ResultSet ID:isc_ResultSet_2 (created by: isc_PickListMenu_0)], 
            "methodName":"fetchRemoteDataReply"
        }, 
        "willHandleError":true, 
        "showPrompt":false, 
        "prompt":"Suche Datensätze die den Kriterien entsprechen...", 
        "oldValues":{
            "operator":"and", 
            "criteria":[
                {
                    "fieldName":"tname", 
                    "operator":"notInSet", 
                    "value":[
                        "test1", 
                        "test2", 
                        "test3"
                    ]
                }, 
                {
                    "operator":"and", 
                    "criteria":[
                        {
                            "fieldName":"tname", 
                            "operator":"iContains", 
                            "value":"system"
                        }
                    ]
                }
            ]
        }, 
        "clientContext":{
            "requestIndex":1
        }, 
        "requestId":"test$6272"
    }

    By the way, if I do not specify any option criteria, the text matching works as expected.

    I would appreciate any help on this issue.
    Last edited by jafr; 19 Oct 2011, 03:42.
Working...
X