Announcement

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

    Applied criteria is not getting reflected in result

    Hi
    Iam trying to validate a new project name by checking wheather the name is already present in the table or not . I try to acheive this action by loading a list grid when user clicks on save button after entering the new name when user clicks save i include the newly given name and another deleted flag as criteria and pass it along with ds request and get the count of total rows fetched on basis of applied criteria . If name is already present in the table result will be greater than 0 else the result will be 0 . But in my case It looks criteria which i passed along with DS request is not reflected in the result

    This is the DS request generated in RPC
    {
    dataSource:"count",
    operationType:"fetch",
    componentId:"isc_ListGrid_9",
    data:{
    operator:"and",
    criteria:[
    {
    fieldName:"ProjectName",
    operator:"equals",
    value:"Testingprojectname"
    },
    {
    fieldName:"DeletedFlag",
    operator:"equals",
    value:0
    }
    ]
    },
    startRow:0,
    endRow:75,
    textMatchStyle:"exact",
    resultSet:[ResultSet ID:isc_ResultSet_10 (created by: isc_ListGrid_9)],
    callback:{
    caller:[ResultSet ID:isc_ResultSet_10 (created by: isc_ListGrid_9)],
    methodName:"fetchRemoteDataReply"
    },
    willHandleError:true,
    showPrompt:true,
    prompt:"Finding Records that match your criteria...",
    oldValues:{
    operator:"and",
    criteria:[
    {
    fieldName:"ProjectName",
    operator:"equals",
    value:"Testingprojectname"
    },
    {
    fieldName:"DeletedFlag",
    operator:"equals",
    value:0
    }
    ]
    },
    requestId:"count$62712",
    internalClientContext:{
    requestIndex:1
    },
    fallbackToEval:false,
    lastClientEventThreadCode:"MMV8",
    bypassCache:true
    }


    This is the raw response in RPC


    [
    {
    affectedRows:0,
    data:[
    {
    User_ID:"26280",
    Project_ID:6,
    ProjectName:"General Category",
    DeletedFlag:false
    },
    {
    User_ID:"000012",
    Project_ID:7,
    ProjectName:"first test",
    DeletedFlag:true
    },
    {
    User_ID:"000012",
    Project_ID:8,
    ProjectName:"New Test",
    DeletedFlag:true
    },
    {
    User_ID:"000012",
    Project_ID:19, ........
    continued....




    This is the DS request code


    final ListGrid chckgrid= new ListGrid(); chckgrid.setDataSource(DataSource.getDataSource("count"));

    Criteria chkcrit = new AdvancedCriteria(OperatorId.AND, new Criterion[]
    {
    new Criterion("ProjectName",OperatorId.EQUALS,Clipname.getText().toString()),
    new Criterion("DeletedFlag", OperatorId.EQUALS,0),
    });
    DSRequest dsRequest = new DSRequest();
    chckgrid.fetchData(chkcrit,new DSCallback()
    {
    public void execute(DSResponse response, Object o, DSRequest request) {
    chckgrid.setData(response.getData());
    int totalcount=response.getTotalRows();
    Window.alert("the total count is "+totalcount);
    }
    ,dsRequest);

    Currently iam getting count value as 260 which is fetched based on user_id alone .But i should get count value as 0 if given name is not available in the table
    So I need to get the result which reflects the applied criteria . Thanks in advance

    #2
    Hi mahbal,

    as enhancement: The declarative way to handle this use case would be like in this thread.

    Best regards,
    Blama

    Comment


      #3
      Remember to post your complete version, as well as the server logs for this request.

      Also, it would never make sense to call listGrid.fetchData() and then call listGrid.setData() in the callback. See the docs for listGrid.fetchData() - it sets up a data manager object called a ResultSet for you. Your attempt to call setData() is both redundant and destroys this data manager object.

      Comment


        #4
        Hi Blama

        When i tried to implement this code in my project there is no error in respective java file but while running code server i got the following error

        [ERROR] Line 242: No source code is available for type com.isomorphic.datasource.DataSource; did you forget to inherit a required module?
        [INFO] [ERROR] Line 246: No source code is available for type com.isomorphic.datasource.Validator; did you forget to inherit a required module?
        [INFO] [ERROR] Line 263: No source code is available for type com.isomorphic.criteria.Criterion; did you forget to inherit a required module?
        [INFO] [ERROR] Line 270: No source code is available for type com.isomorphic.criteria.criterion.SimpleCriterion; did you forget to inherit a required module?
        [INFO] [ERROR] Line 270: No source code is available for type com.isomorphic.criteria.DefaultOperators; did you forget to inherit a required module?
        [INFO] [ERROR] Line 277: No source code is available for type com.isomorphic.criteria.AdvancedCriteria; did you forget to inherit a required module?
        [INFO] [ERROR] Line 278: No source code is available for type com.isomorphic.datasource.DSRequest; did you forget to inherit a required module?
        [INFO] [ERROR] Line 283: No source code is available for type com.isomorphic.datasource.DSResponse; did you forget to inherit a required module?


        Note: isomorphic-core-rpc-5.0.jar is already available in maven dependency

        Comment


          #5
          Hi mahbal,

          that code in the link is *server side* code to be used on the server only and referenced from your .ds.xml file.

          See the example in the linked thread.

          Best regards,
          Blama

          Comment

          Working...
          X