Announcement

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

    setAllowFilterExpressions problem

    Hi

    I am using SmartClient Version: SNAPSHOT_v8.3d_2012-08-15/PowerEdition Deployment (built 2012-08-15).
    with IE 7 browser.

    I have a data source looking like this:

    <DataSource ID="codelistCodesOfDimensionDS"
    serverType="sql" tableName="someTableName">
    <fields>
    <field name="aFieldName" type="text" title="Value"/>
    <field name="anotherFieldName" type="text" title="Description" />
    <field name="IS_SELECTED" type="boolean" title="Selection" hidden="true"/>
    </fields>

    <operationBindings>
    <operationBinding operationType="fetch">
    <selectClause>DISTINCT
    aFieldName, anotherFieldName,
    CASE
    WHEN INSTR($criteria.selection, ''''||aFieldName||'''') > 0
    THEN
    'true'
    ELSE
    'false'
    END
    AS "IS_SELECTED"
    </selectClause>
    <tableClause>someTableNames </tableClause>
    <whereClause>somefieldName= $criteria.dimension
    AND ($defaultWhereClause)
    </whereClause>
    </operationBinding>
    </operationBindings>
    </DataSource>


    The ListGrid attached to this DS has the filter editor visible.
    Criteria are properly defined in the grid and everything works fine, data is properly shown.

    For a successful request, when tracking RPCs on the Console, we see:

    {
    dataSource:"codelistCodesOfDimensionDS",
    operationType:"fetch",
    componentId:"isc_ListGrid_1",
    data:{
    dimension:"6501",
    selection:"'OILBRNI'"
    },
    startRow:0,
    endRow:75,
    textMatchStyle:"substring",
    resultSet:[ResultSet ID:isc_ResultSet_0 (created by: isc_ListGrid_1)],
    callback:{
    caller:[ResultSet ID:isc_ResultSet_0 (created by: isc_ListGrid_1)],
    methodName:"fetchRemoteDataReply"
    },
    willHandleError:true,
    showPrompt:true,
    prompt:"Finding Records that match your criteria...",
    oldValues:{
    dimension:"6501",
    selection:"'OILBRNI'"
    },
    requestId:"codelistCodesOfDimensionDS$6270",
    clientContext:{
    requestIndex:{
    localeProperties:Obj,
    localeStringFormatter:"toString",
    formatter:"toString",
    Class:"Number"
    }
    },
    bypassCache:true
    }

    However this construction breaks if i set hugeCodelistGrid.setAllowFilterExpressions(true);

    In this case the error message received on filtering the data with the filter editor is "ORA-00911: invalid character", as if $criteria objects ($criteria.dimension and $criteria.selection) are not properly taken into account anymore.

    For a failed request, when tracking RPCs on the Console, we see the request parameters:
    {
    dataSource:"codelistCodesOfDimensionDS",
    operationType:"fetch",
    componentId:"isc_ListGrid_7",
    data:{
    operator:"and",
    criteria:[
    {
    fieldName:"aFieldName",
    operator:"iContains",
    value:"sdfsf"
    },
    {
    operator:"iContains",
    fieldName:"dimension",
    value:"6501"
    },
    {
    operator:"iContains",
    fieldName:"selection",
    value:"'OILBRNI'"
    }
    ]
    },
    startRow:0,
    endRow:75,
    textMatchStyle:"substring",
    resultSet:[ResultSet ID:isc_ResultSet_6 (created by: isc_ListGrid_7)],
    callback:{
    caller:[ResultSet ID:isc_ResultSet_6 (created by: isc_ListGrid_7)],
    methodName:"fetchRemoteDataReply"
    },
    willHandleError:true,
    showPrompt:true,
    prompt:"Finding Records that match your criteria...",
    oldValues:{
    operator:"and",
    criteria:[
    {
    fieldName:"aFieldName",
    operator:"iContains",
    value:"sdfsf"
    },
    {
    operator:"iContains",
    fieldName:"dimension",
    value:"6501"
    },
    {
    operator:"iContains",
    fieldName:"selection",
    value:"'OILBRNI'"
    }
    ]
    },
    requestId:"codelistCodesOfDimensionDS$62712",
    clientContext:{
    requestIndex:{
    localeProperties:Obj,
    localeStringFormatter:"toString",
    formatter:"toString",
    Class:"Number"
    }
    },
    bypassCache:true
    }

    As said above, the whole construction works fine until we set setAllowFilterExpressions to true. Unfortunately we need filter expressions because we need to have more complex filtering enabled.

    Please could you help me understand where the mistake could be.

    Many thanks.

    #2
    AdvancedCriteria is a nested structure where multiple criteria could be applied to the "dimension" field, so $criteria.dimension is potentially ambiguous.

    If you know there's exactly one criteria targeting "dimension", you can use $advancedCriteria.dimension - this will retrieve the value for the first Criterion on the "dimension" field that appears in the AdvancedCriteria structure (by depth-first search).

    See also the server-side APIs dsRequest.getCriteriaValue().

    Comment


      #3
      Thank you very much, Isomorphic! Your solution solved our problem.

      Comment

      Working...
      X